Support

Account

Home Forums ACF PRO How do I assign ‘Archive’ to taxonomy?

Solved

How do I assign ‘Archive’ to taxonomy?

  • I wanted to do something like this in Taxonomy:
    https://imgur.com/NIUHfos

    I couldn’t find this option within Taxonomy > Advanced Settings. I can only see this in Post Types.

  • Taxonomies automatically have archives in WP, is it not something that can be turned off.

  • I have been noticing an issue with this.

    When I generated the PHP code from ACF > Tools > Export, I could not see any “archive” key/value field in the PHP code.

    I created a hierarchical taxonomy called ‘course_categories’. It generates the category URLs like these:
    https://example.com/course_categories/craft/ <- working
    https://example.com/course_categories/craft/jewellery/ <- working

    However, this link: https://example.com/course_categories/ always returns page not found.

    How do I resolve this?

  • Have you altered the “public” or “publicly_queryable” settings?

    Try visiting the Settings => Permalinks admin page, this will cause WP to regenerate rewrite rules.

  • Both the “public” or “publicly_queryable” settings have always been switched on. I had already tried regenerating rewrite rules by re-saving the permalink several times.

  • Sorry, I just realized what’s going on.

    There is no page for https://example.com/course_categories/, or https://example.com/{$taxonomy}/, this is not a valid page in WP. Archive pages only list posts in a specific term. In other words, there is no page in WP that will list all of the terms in a taxonomy.

  • Yes, I thought so too. The same is true on the default blog categories in WP. I guess that’s something that needs to be dealt with within the CMS?

  • The only way to do this in WP is to create a “Page” with a “Custom Template” and then generate the content yourself.

    If you look at the WP template hierarchy there is no available file to create this list of terms automatically.

    Generally, taxonomy terms are listed on the post archive page.

    As an example, WooCommerce has a CPT for product and a Custom Taxonomy for product categories. When you view the “Shop” page a list of categories or sub categories is shown with links to those categories followed by a list of products in the current category when a specific category is shown.

  • Yes, I think that seems to work for me now. So, it looks like a new “page” must be created in WP with the same slug as the taxonomy. In my above example, I created a new page with a slug course_categories. Then, that got tied up to page.php template instead of returning the “page not found”. I could also create a new template page-{taxonomy}.php.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.