Is there a way to start a post and have some default terms already added to the taxonomies?

1 Answer 1


You can use the transition_post_status action for that. New posts transition from new to auto-draft, so we check for that condition to only add terms on that initial auto-save.

function wpd_add_post_terms( $new_status, $old_status, $post ) {
    if( 'new' == $old_status && 'auto-draft' == $new_status ){
        wp_set_post_terms( $post->ID, array( 42, 23 ), 'category' );
add_action( 'transition_post_status', 'wpd_add_post_terms', 10, 3 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.