Support » Fixing WordPress » Assigning existing terms to taxonomy

  • Resolved Mitchell Bundy

    (@mitchbundy)


    Greetings!

    Is there any clean way to add an existing term, that is currently assigned to one taxonomy, to another taxonomy?

    Using wp_insert_term, it will add a new term no matter what. I don’t want this to be an “alias” as I would like to keep the same term_id. Basically, all I would need is to put an entry into the wp_terms_taxonomy table, but you know, I’d like to avoid custom sql queries as much as I can.

    I am mapping users and photos to albums, and have two taxonomies, “album-user” and “album”. Basically any user assigned to the term can post photos within that term.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Figured out my own problem. But if anyone find it useful, you must specify the exact name and slug of the term in wp_insert_term as such:
    wp_insert_term($term->name, 'taxonomy', array('slug' => $term->slug));

    However, it would be nice to simply do this by id with a wp_assign_term

    This should be documented! Thanks, exactly what I needed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assigning existing terms to taxonomy’ is closed to new replies.