Reputation: 1089
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 created 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 know the template does its job because on some occasions as I've poked around troubleshooting I've had it working. However, I can't find a consistent condition that causes the page to work. I suspect that the problem has something to do with the rewrite but my tests have been inconclusive.
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.
Upvotes: 0
Views: 4182
Reputation: 1089
The source of the problem was that I had included a rewrite for the taxonomy, while at the same time using pages with assigned templates. Once the rewrite was removed it appears that everything worked correctly.
Upvotes: 0
Reputation: 644
As I understand it, WordPress has a hierarchy / parse order (so to speak) as to what it looks for when it gets a request. Technically, a taxonomy is just a tag.
I'm not sure if this will help:
http://justintadlock.com/archives/2009/06/04/using-custom-taxonomies-to-create-a-movie-database
But J.Tadlock is always a solid place to start.
Upvotes: 1