Is there a function in WordPress that will check if the page you are on is a sub-category archive page?
Like the way is_category checks if it’s a category page?
Is there a function in WordPress that will check if the page you are on is a sub-category archive page?
Like the way is_category checks if it’s a category page?
You must be logged in to post a comment.
Sub-categories use the regular category archive page by default. There is no function such as is_subcategory. But you can write your own.
Here is an example:
This will check if the current page is a sub-category. Or if you pass an ID it will check if the ID is a subcategory.
If you want to check the current location (without the need to specify an ID):