I have made a function to apply a taxonomy term to post, if it has a post meta value set to true. This works as should. The problem I am facing is that it only updates after I have manually saved/updated the post. Is there any way to schedule this or do it dynamically for all posts inside the custom post type? My code for the taxonomy term function:
function save_cp_term_meta( $post_id, $post, $update ) {
$termshouldbe='new';
$meta_value = get_post_meta( $post->ID, 'new_used_cat', true );
if (!empty( $meta_value )) {$termshouldbe='used';}
else {}
wp_set_object_terms($post_id,$termshouldbe,'vehicle_condition',false);
}
add_action( 'save_post', 'save_cp_term_meta', 10, 3 );
new_used_cat
can be modified by another way that on the post edition ?