As we have seen in our previous post “How to display WordPress Categories on home page of website” we added Category index into our home page, and we added subcategories into Category archive page, but while doing it started showing category index onto our tag pages also, hence we now needed to distinguish whether we are on tag archive page or category archive page so we can hide categories from tag pages. WordPress provides following API’s for the same, is_category – Returns TRUE if we are on category archive page is_tag – Returns TRUE if we are on tag archive page The related code implementation will look like as below, <?php if (is_category()) { ?> //this is category archive page <?php } elseif (is_tag()) { ?> //this is tag archive page <?php } ?> You can find more details about identifying different archive pages at https://codex.wordpress.org/Function_Reference/is_archive

Command line execution

Terminalbash
find more details about identifying different archive pages at  https://codex.wordpress.org/Function_Reference/is_archive

Gotchas and common issues

  • Permission checks - verify user access rights and sudo privileges before executing system-level operations.

  • Environment configuration - double-check path variables and dependency versions to prevent runtime failures.

  • Backup safeguards - maintain configuration backups before applying system or database modifications.

Following these steps ensures clean configuration and reliable execution for check if its tag page or category page in wordpress.