WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Rewrite taxonomy slug in archive permalink (8 posts)

  1. Ann-Sophie
    Member
    Posted 1 year ago #

    I can access my custom taxonomies with this url: www.example.com/taxonomy-name/term

    But I'd like to have this rewritten to www.example.com/term

    Can anyone help me out with that? I have no idea where to start.

  2. bcworkz
    Member
    Posted 1 year ago #

    This is more difficult than it seems. The query parser needs some way to know the parameter belongs to the taxonomy and is not a post slug, date, author or other value it may need to query for.

    If there are not too many terms, your rewrite rule could effectively say "if the parameter is equal to one of the values on a short list, it is part of X taxonomy, otherwise process normally"

    If there are a lot of terms, there needs to be some common element to distinguish this taxonomy query from any other type of query.

  3. icd10
    Member
    Posted 1 year ago #

    Did you try

    RewriteRule ^term/(.*) /taxonomy/term/$1 [L,R=301]

  4. Ann-Sophie
    Member
    Posted 1 year ago #

    That works like a charm!
    Perfect! Thanks a lot!

  5. Ann-Sophie
    Member
    Posted 1 year ago #

    Hi icd10,

    I think I cheered too soon... The archive pages still have the custom taxonomy name before the term.
    If I click a post the taxonomy name is gone though. Any ideas?

  6. Ann-Sophie
    Member
    Posted 1 year ago #

    The plugin to remove the taxonomy name added this to .htaccess:

    RewriteRule ^wp-types-group/(.+)/$ /$1 [R=301,L]
    RewriteRule ^{taxonomy-name}/(.+)/$ /$1 [R=301,L]

    Doesn't seem to work either.

  7. Ann-Sophie
    Member
    Posted 1 year ago #

    Any ideas? Any help is appreciated!

  8. Ann-Sophie
    Member
    Posted 12 months ago #

    This turned out to be a plugin bug (WPML) I got great support there!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.