WordPress.org

Ready to get started?Download WordPress

Forums

How to visit a taxonomy archive (16 posts)

  1. lola rennt
    Member
    Posted 4 years ago #

    Dear WordPressers,

    I am getting a little discouraged on this topic as I have been browsing this forum thoroughly and don't seem to find the right answer. Any help is appreciated.

    I have made custom taxonomies with this custom-taxonomies in wordpress tutorial.

    Now as Justin says you'd have to be able to visit a taxonomy archive and set up a template for this.
    I can setup a template for taxonomy-people-justin-tadlock.php, but nor for taxonomy-people.php .
    When I visit this url wordpress/people/ I get a 404 error although I do have a template for this.
    Please help me out with this…
    Custom taxonomies sound great but they are kind of driving me mad.

    xLauren

  2. MichaelH
    Member
    Posted 4 years ago #

  3. lola rennt
    Member
    Posted 4 years ago #

    Thanks for your help Michael!
    Somehow I think this is just a little bit too complicated for what I am trying to do.
    Isn't the taxonomy-tax.php already included in the WP structure? For me it should work like category.php works… or tag.php. But maybe I am missing sth here?

  4. MichaelH
    Member
    Posted 4 years ago #

  5. lola rennt
    Member
    Posted 4 years ago #

    Yes, well I was aware of this… and that's why I don't understand.
    Wordpress can call this taxonomy-{taxonomy}-{term}.php template of mine with success but not this taxonomy-{taxonomy}.php template. Then I get a 404 error…

    This works http://wordpress/location/sint-niklaas/
    but nor this http://wordpress/location/

    Maybe my code on that page is not right? I just copied the page.php template for this template. Is there some reference somewhere on how to build this exact template?

  6. Justin Tadlock
    Member
    Posted 4 years ago #

    The /location page doesn't exist because WordPress doesn't just make a page based off your URL structure. You can create a "Page" called "location" if you need to show content there.

    taxonomy-people.php is the default template for term archives within the people taxonomy. taxonomy-people-justin-tadlock.php is the archive template for one specific term.

  7. lola rennt
    Member
    Posted 4 years ago #

    Okay now I finally understand why it wasn't working. I expected the taxonomy-people.php to be rendered when someone visits http://wordpres/people/ - but it isn't meant for that. taxonomy-people.php is the template for a term within the people taxonomy - not the taxonomy itself.

    I've now made a custom _get variable containing the taxonomy name - I can then get all the terms that belong to that taxonomy and loop through them to render a list of posts that have a tag that belongs to that taxonomy.

    I still wonder if there isn't a standard way to do this - but my hack works : )

    Thanks!

  8. Mark McWilliams
    Member
    Posted 4 years ago #

    Yeah, how stupid that /location/ just 404's on you, where do I start? We shouldn't need to create a seperate page, just to cover up something! :( In February, there was a discussion that I started on this very topic which got 75+ replies, so it struck nerve somewhere ... just look and see how many people agree that something needs to be altered! :D

    That's not to mention all the people I talked to on Twitter, and various other places who agreed with what I and others were saying on the matter!

  9. magaworks
    Member
    Posted 3 years ago #

    Hi laurenserge, I have a similar problem. Everytime I click a term in my taxonomy cloud it goes to a 404 error page. How did you fix this problem?

  10. lola rennt
    Member
    Posted 3 years ago #

    Hi magaworks,
    the 404 problem could be solved by updating your permalinks - at least that's what worked for me.
    Here you see how you can update them. I chose to set them in archive mode - month and name - and that worked perfectly!

  11. Justin Tadlock
    Member
    Posted 3 years ago #

    You don't have to update your permalinks. You merely need to visit the Permalinks settings page because it flushes your rewrite rules.

  12. magaworks
    Member
    Posted 3 years ago #

    thanks. Solved :)

  13. dlh
    Member
    Posted 3 years ago #

    You merely need to visit the Permalinks settings page because it flushes your rewrite rules.

    I spent at least two hours smashing my head because my archives broke whenever I tried to add a new custom taxonomy. I never would have thought to try something so simple. Problem solved. Thanks.

  14. Sebastien Couture
    Member
    Posted 3 years ago #

    Hi laurenserge,

    I have the exact same problem. I found out that in fact, WP may in fact be looking for a category with the name of your taxonomy, hence the 404 since it doesn't exist.

    Can you post an example of your custom _get request please ?

    Thanks

    Sebastien

  15. tiny.explosion
    Member
    Posted 3 years ago #

    @Greenshady Thanks! it worked for me too. I Just opened the permalink setting page and clicked "save changes" (without actually changing anything) and it worked! :)

  16. Tom Auger
    Member
    Posted 3 years ago #

    Also remember that if your custom taxonomy term is empty (ie: no posts or pages are using that term), some themes (ie: TwentyTen) show what looks like an Error 404 page (it's not really). So if you're testing custom taxonomy "category" pages, make sure you actually have some posts that belong to that term.

Topic Closed

This topic has been closed to new replies.

About this Topic