Forum Replies Created

Viewing 1 replies (of 1 total)
  • Forum: Plugins
    In reply to: wp_set_post_tags

    I had a similar problem:

    wp_set_post_categories($wpdb->insert_id, array($req->wpcat));
    wp_set_post_tags($wpdb->insert_id, $tags);

    wp_set_post_categories uses the $wpdb object to insert, thus changing the insert ID.

    I fixed it by doing this:

    $post_ID = $wpdb->insert_id;
    wp_set_post_categories($post_ID, array($req->wpcat));
    wp_set_post_tags($post_ID, $tags);

    This works as of 2.7.0.

    Hope someone finds this helpful.

    Reminder: $tags holds a single dimensional array. Ex:

    $tags = array('one', 'two', 'three');
Viewing 1 replies (of 1 total)