WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom Taxonomy Terms Page Not Found (13 posts)

  1. dorich
    Member
    Posted 1 year ago #

    I’m getting a Page Not Found message when clicking on the link to display the terms in a taxonomy

    Scenario:
    I have a custom post type called glossary
    Attached is a custom taxonomy called section with the rewrite set to “library/glossary-start-here”

    I want a page that lists the terms in the taxonomy. This is a WordPress page with the slug of “glossary-sections” - the template for the page is set to “taxonomy-section.php”. The page is a child of “library” and so the permalink for the page is “example.com/library/glossary-starts-here/glossary-sections/“

    The template “taxonomy-section.php” has the following code:

    <?php // Begin header section.
    $argterms=array(
    	'include' =>array(
    		117,118,115)
    	);
    $terms = get_terms('section', $argterms);
    echo '<ul>';
    foreach ($terms as $term) {
        echo '<h3><a href="'.get_term_link($term->slug, 'section').'">' . $term->name . '</a></h3>';
    }
    echo '</ul>'; ?>
    <div>
    <?php

    When clicking on the link to the page “glossary-sections”, which is used on a number of other pages, I get a page not found message.

    I’d appreciate any suggestions on why this isn’t working and how to correct it.
    I’m particularly puzzled by the fact that I can specify a page like “glossary-section” and yet have it not be found.

    Thanks.

  2. wpismypuppet
    Member
    Posted 1 year ago #

    This might be silly, but have you visited settings->permalinks? You don't have to change anything, but just visiting that page resets the permalinks. This is a common fix for a lot of taxonomy rewrites.

  3. dorich
    Member
    Posted 1 year ago #

    @wpismypuppet

    Thanks for the suggestion. I've been trying that as part of my experimentation, however, it doesn't solve the problem.

  4. wpismypuppet
    Member
    Posted 1 year ago #

    So to get this straight... you have a physical page with a slug called "library", a child page with a slug called "glossary-section" and a custom taxonomy where the terms will display as "library/glossary-start-here/[term-name-here]", correct?

    And you want to be able to see a page called "library", a taxonomy archive called "glossary-section", and when any term is clicked, a taxonomy term page called "/library/glossary-start-here/[term-name-here]"??? Is that correct?

  5. dorich
    Member
    Posted 1 year ago #

    @wpismypuppet
    Apologies if my description is unclear, there are couple of modifications to your description. Hopefully this clarifies the description of my setup:

    Page Structure
    Page: Library (contains a link to glossary-sections)
    Page: glossary- start-here
    Page: glossary-sections (List of taxonomy terms on this page)
    Page: taxonomy archive listing glossary posts under the selected term

  6. dorich
    Member
    Posted 1 year ago #

    @wpismypuppet
    Ah, that list didn't come out as expected, hopefully this will display

    page Structure

    • Library
      • glossary-start-here
        • glossary-sections
          • taxonomy archive
  7. wpismypuppet
    Member
    Posted 1 year ago #

    Do you have a custom post or custom taxonomy that shares the slug "glossary-sections" by any chance?

  8. dorich
    Member
    Posted 1 year ago #

    @wpismypuppet
    No. I just checked back to make sure.
    Also one of the experiments I ran was to change the slug of the page "glossary-sections" to "section". Then changed the calling link to match. Then visited the permalink settings.
    That didn't solve the problem, so it appears I don't have any conflicting slugs.

  9. wpismypuppet
    Member
    Posted 1 year ago #

    Well, that test wouldn't work, right? Cause you have a custom taxonomy called "section". Change "glossary-sections" permalink to something completely unique and see if you can access the page that way.

  10. dorich
    Member
    Posted 1 year ago #

    Unfortunately not.
    Changed the slug to "unique", changed the calling link and revisited the permalink settings.

  11. dorich
    Member
    Posted 1 year ago #

    It appears that the source of the problem was adding the rewrites. These seem to be unnecessary for my purposes. Once removed everything appears to work as expected.

  12. wpismypuppet
    Member
    Posted 1 year ago #

    Wonderful! I'm glad you could pin point the issue... We had a similar issue with custom posts and custom taxonomies and pages that need to share slugs and paths... I was looking into that as another choice which involved custom rewrite rules, but your solution worked, so right on!

  13. dorich
    Member
    Posted 1 year ago #

    @wpismypuppet
    Thanks so much for your help.
    Time is valuable and I appreciate you giving up some of your time to help.

Topic Closed

This topic has been closed to new replies.

About this Topic