There are 2 ways that you could do this. The first and more difficult is to write a program, the other is to do a bulk update. Why do difficult when easy way will work equally well? and especially as this is a once-off requirement
The easy way:
- In the admin dashboard, select the view with all posts for your custom type
- Select all the posts (tick them) – You can see more posts by clicking ‘Screen Options’ at the top right of the view and increasing the number of items per page
- Click the down arrow next to ‘Bulk Actions’ and select edit
- Press ‘Apply’ – you will get a screen with a selection of changes you can make
- Make some change, like add a tag or change author (whatever)
- Press ‘Update’
That should do it.
The ‘difficult’ way:
In case anyone wants to use the code solution, you can add the code below to the functions.php file in your child theme.
function my_update_posts() {
//$myposts = get_posts('showposts=-1');//Retrieve the posts you are targeting
$args = array(
'post_type' => 'post',
'numberposts' => -1
);
$myposts = get_posts($args);
foreach ($myposts as $mypost){
$mypost->post_title = $mypost->post_title.'';
wp_update_post( $mypost );
}
}
add_action( 'wp_loaded', 'my_update_posts' );
Remember to run this only once and then remove it or comment out the add_action line otherwise it will run every time a new page is loaded.
I included this option in case anyone wants a start template for updating all post titles or some other property in all posts.