Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Custom Post Type Taxonomie Archive Error 404 WordPress

  • SOLVED


You probably could of guessed I would have ended up here for this, because of all the taxonomy help I've had.

<strong>Problem</strong>

When I click on a taxonomy link (generated via get_the_term_list), I get the dreaded 404. When I should be getting my archive template?

I guess I've missed a trick somewhere... but first I'm using the archive.php for all my archives. Is this a problem? I thought wordpress worked by a template hierarchy so all types of archives would revert to the archive.php if no alternative template exists?

Anyway this is my functions PHP, which is generating one custom post type '<strong>download</strong>' and two taxonomies for my custom post type. They are '<strong>group</strong>' which is hierarchical and '<strong>meta</strong>' which is non-hierarchical.

See full functions here... [[LINK href="https://gist.github.com/1506712"]]https://gist.github.com/1506712[[/LINK]]

Find the registered taxonomies line 130

I seems like a common problem but can't find a simple solution.

Thanks in advance.
Josh

Answers (2)

2011-12-21

John Cotton answers:

You should use a file call taxonomy-group.php.

If you want to reuse the code in archive.php, just include that file.

And MAKE SURE YOU'VE RE-SAVED YOUR PERMALINKS!


Josh Cranwell comments:

Ok I made a taxonomy-group.php and taxonomy-meta.php but still not working.

How do you mean "re-saved permalinks"?

Thanks


John Cotton comments:

<blockquote>How do you mean "re-saved permalinks"?</blockquote>

Dashboard > Settings > Permalinks > Save

Peter also has a good point - I hadn't noticed that. In will work, but only for one of them (whichever is first in the rewrite rules...). If you don't ever want to have users browse by one or other of those tags, just set that one to rewrite => false.

If it still doesn't work, check what's actually happening by viewing one of the taxonomies from the dashboard (the view link under each value in the list). If it works, check what the URL is - that could be your problem.

If it doesn't work.....


John Cotton comments:

Dashboard > Settings > Permalinks > Save

This step is really important when using rewrites as it's the best way to get your rewrite into the list. If your rewrite isn't in the list, WP doesn't know how to handle your url....


Josh Cranwell comments:

Hi John,

Sorry didn't actually think you meant literally re-save permalinks.

Could not vision that actually working, but re-saved and bingo.

Thanks!!!

2011-12-21

Peter Michael answers:

You're using the same rewrite for both taxonomies? I don't think that'll work ('rewrite' => array( 'slug' => 'downloads' ),).


Josh Cranwell comments:

Hmmm good idea but still no return on archive page.

I've even created taxonomy.php archive pages :-/


Peter Michael comments:

As John mentioned: try go to Settings->Permalinks and re-save the current settings.


Josh Cranwell comments:

bingo bango!


Josh Cranwell comments:

Thanks!!


Peter Michael comments:

You're welcome. Add your vote for John pls, thanks.