Support » Fixing WordPress » how to automatically add taxonomy keyword when a post published

Viewing 5 replies - 1 through 5 (of 5 total)
  • i tried wp_set_object_terms , but tag must be already exist 🙁

    i found this

    // Create the post array
    $post = array(
        'ID' => 5,
        'tags_input' => 'foo,bar,baz');        
    
    // Update the post
    wp_update_post($post);

    but now how use this with custom taxonomy

    i tried this

    wp_set_object_terms($post_id,'test', 'test_taxonomy', false );

    but the taxonomy not assigned to the post

    have you tried set_post_terms? and passed a variable into a parameter? I feel like set_post_terms and there might be a insert_term, but not quite sure.

    You also have to add a hook (hook it onto when something occurs) onto the wordpress publish function, I believe.

    i tried this too, and it don’t working 🙁

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to automatically add taxonomy keyword when a post published’ is closed to new replies.