WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Wrong archive link when using the_terms (3 posts)

  1. David M.
    Member
    Posted 2 years ago #

    I want to display a custom taxonomy on single posts, with a link to the archive page for that term. I use this code:

    <?php the_terms( $post->ID, 'taxonomyname' ); ?>

    It displays correctly the terms associated to that post. The link I get is: wordpress/?taxonomy=taxonomyname&term=taxonomyterm

    That link doesn't work. I have pretty permalinks, multisite, and the correct link for that archive is: wordpress/blog/taxonomyname/taxonomyterm/.

    I'm using a custom child theme of Twenty eleven.

    What could I do? Thanks.

  2. David M.
    Member
    Posted 2 years ago #

    I have found that flushing the permalink structure is required and I have done that according to:

    http://seanbehan.com/programming/how-to-flush-your-permalink-structure-in-wordpress-when-using-taxonomies-or-wordpress-taxonomies-not-working-instead-i-see-a-404-page/

    Didn't work. The correct URL for the custom taxonomy permalink IS the pretty permalink. But the_terms is still displaying a different, non-pretty permalink.

    Any ideas?

  3. David M.
    Member
    Posted 2 years ago #

    I just found the problem. I was getting this link:

    wordpress/?taxonomy=taxonomyname&term=taxonomyterm

    But the taxonomy was actually registered as "Taxonomyname". With a capital letter.

    I changed the definition of the taxonomy, wrote its name without capital letters, flushed a couple of times, and it's working now.

Topic Closed

This topic has been closed to new replies.

About this Topic