Forums

[resolved] Same term in new taxonomy – how? (3 posts)

  1. Nicht Mehrda
    Member
    Posted 9 months ago #

    The situation:
    - I have lots of terms in the "Category" and "Tag" taxonomy.
    - I have created a custom taxonomy, and I want to add terms and posts.
    - When adding a term, I want to reuse terms which already exist in other taxonomies.

    However, when calling wp_set_object_terms($postId, $termName, $taxonomy), WordPress always creates a new term, resulting in a new, ugly slug.

    How can I tell WordPress to use existing terms in the new taxonomy?

  2. Nicht Mehrda
    Member
    Posted 9 months ago #

    Wow, that's weird … for one term, WordPress reuses the existing term entry, for another term it creates a new slug. :-/ Let's go bug hunting …

  3. Nicht Mehrda
    Member
    Posted 9 months ago #

    Ok, got it … I didn't know that term_exists() is comparing by name, not by slug. Turned out that one term started with a lowercase letter, while the new one was uppercase.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.