Forums

[resolved] Trying to merge a couple tags in PHP (2 posts)

  1. christopherross
    Member
    Posted 1 year ago #

    I have an annoying problem where a couple tags reinsert themselves in my database and I'm looking for a way through PHP to auto merge them.

    What I have is a $term_id for the first and a $second_id for the second, is there an easy way to make all of $second_id merge into $term_id?

  2. christopherross
    Member
    Posted 1 year ago #

    Scribu was nice enough to help me with this offline, the solution is:

    wp_delete_term( $term_id, 'post_tag', array( 'default' => $second_id, 'force_default' => true ) );

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags