I have a site with a custom post type called questions and a hierarchical custom taxonomy called agencies. A question will always belong to a subcategory of an agency. There is a URL re-write that inserts /knowledge-center/agencies/ before the taxonomy term.

The archive page for the agency taxonomy term works:

/knowledge-center/agencies/fdny/

and the individual question pages properly insert the hierarchy of the taxonomy:

/knowledge-center/agencies/fdny/fire-safety-guides-and-notices/fire-safety-notice/

However the archive page for the taxonomy sub term 404’s:

/knowledge-center/agencies/fdny/fire-safety-guides-and-notices

When I look at the page using Query Monitor, the matched rule appears to be:

^knowledge-center/(.)/(.)/(.*)

And it’s looking for the basic page template.

Basically it’s dropping the /agencies part of the URL rewrite for the taxonomy sub term. Although it’s properly working for the taxonomy term:

knowledge-center/agencies/(.+?)/?$
And pulling the /taxonomy-agencies.php template.

Don’t know why the sub term query isn’t working, but it’s driving me insane.

Any ideas?

Read more here: WordPress Custom Hierarchical Taxonomy Archive page problem


Solution:

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: