WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How does WordPress check for updated taxonomy SLUGS? (4 posts)

  1. openwp3
    Member
    Posted 1 year ago #

    I have a taxonomy similar to Categories that's working fine. But when I change the SLUG of a term, Objects no longer show up on the Taxonomy's result page (or the original results, with the old slug).

    I logged into PHPMYADMIN and the old slug is not listed in: _wp_old_slug

    Would I need a function using wp_check_for_changed_slugs? Can that work?
    http://codex.wordpress.org/Function_Reference/wp_check_for_changed_slugs

    Is there a way to check for old and new slugs for anything: Tags, Categories, Taxonomies, etc?

    I'm using pre_get_posts for the Custom Taxonomy $query and that's working great otherwise, only breaks when I change the term SLUG.

    Any ideas?

  2. Justin
    Member
    Posted 1 year ago #

    Are you the author that built the theme you are using?

    In all my past experience I have not had to do any updated check.

  3. openwp3
    Member
    Posted 1 year ago #

    Yes I am. I created a custom taxonomy and for some reason, when the SLUG changes, posts won't display.

    But I was just reading about a possible alternative way of doing this. The custom taxonomy is for attachments, and read how about how, in the newer version of WordPress, it's easier to connect already registered Taxonomies (i.e. Categories), to already registered Post Types (Attachments).

    Only issue then would be how to use a different template file for archives display when is_attachment?

    Any idea how I can use a template file other than: category.php for any term when is_attachment?

  4. openwp3
    Member
    Posted 1 year ago #

    Ok, I decided to register an existing Taxonomy to attachments:

    register_taxonomy_for_object_type( 'category', 'attachment' );

    I believe the issue I was having may have been because of the naming scheme I choose for the custom taxonomy. The slug was very unique, but the word "Category" was included in the full display name, so I think WordPress was getting confused when I added terms/edited slugs.

    This seems a much better solution anyway.

    Hope it helps someone else out.

Topic Closed

This topic has been closed to new replies.

About this Topic