Update all posts at once

I got the same need, personally I used wp_set_object_terms after a WP_Query resquest on all of my custom post type. I suppose you could replace my_custom_type with post in the following quote of my code:

$my_query = array(
    'post_type' => array( 'post', 'my_custom_type' ) );
$the_query = new WP_Query( $my_query );

while ( $the_query->have_posts() ) : $the_query->the_post();

    $id = get_the_ID();
    wp_set_object_terms( $id, "my_new_tag_value", "my_tax_slug", $append=true );

endwhile;

Leave a Comment