Skip to content

Instantly share code, notes, and snippets.

@wickywills
Created November 6, 2019 08:33
Show Gist options
  • Save wickywills/dd83e4c782cfa6dddbfd63409c44d7a1 to your computer and use it in GitHub Desktop.
Save wickywills/dd83e4c782cfa6dddbfd63409c44d7a1 to your computer and use it in GitHub Desktop.
```
/*
Plugin Name: Bulk Update Post
Description: Quick plugin to update posts with whatever you want
Author: James Wills
*/
add_action('init','update_stuff');
function update_stuff(){
$my_posts = get_posts( array('post_type' => 'product' ) );
foreach ( $my_posts as $my_post ):
if($my_post->post_title === 'test-en') {
$my_post->post_title = 'test-en-updated';
}
wp_update_post( $my_post );
endforeach;
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment