How do if all posts has this category ID then do this

I need a wordpress function that search all the posts inside my website and if one or multiple posts have the category ID (example 25) echo “yes”, else echo “no”

I was trying to do:

if ( has_category(25) ) {
echo “OK”;
} else {
echo “NO OK”;
}

But dont work

Read more here:: How do if all posts has this category ID then do this

Leave a Reply

Your email address will not be published. Required fields are marked *