A WordPress website has this structure:

TopCat1 > subcat > post

TopCat2 > subcat > post

TopCat3 > subcat > post

What is the PHP code to show the word checked only if current post has a specific top level category named “TopCat2”?
It doesn’t mind if it’s inside a subcategory or not.

Read more here: Check if WordPress post has a specific category


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: