Is there a way to bulk tag all posts which have for instance "bottle" in their titles? Thanks!
Did a little bit of searching around this site and found some links that should help you achieve your goal
2) Updating the "tags" for a specific post is fairly simple with this function:
wp_set_object_terms($post_id, 'mytagname', 'post_tag', true);
3) When you put everything together, it should look something like this (this code is untested)
add_filter( 'posts_search', '__search_by_title_only', 500, 2 ); $query = new WP_Query( array( 's' => 'title_to_search_for' ) ); remove_filter( 'posts_search', '__search_by_title_only', 500 ); if ( $query->have_posts() ) : while ( $query->have_posts() ) : $post_id = get_the_id(); wp_set_object_terms($post_id, 'tag_to_add', 'post_tag', true); endwhile; wp_reset_postdata(); endif;