Faking the “onSave” event

Have you seen wpshell? It’s a command line tool for wordpress. Basically, it’s a WordPress environment that lets you run arbitrary php – so you could set up a WP_Query that pulls all posts, loop through them, and fire that command on each one.

Sort of what I had in mind, untested. Using wp_update_post() as it contains the save_post hook, and is the equivalent of hitting ‘update’ on the post edit screen:

$args = array('posts_per_page' => -1, 'post_type' => 'any')
$query = new Wp_query($args)
while ( $query->have_posts() ) : $query->the_post();
    $post->wp_update_post();
    echo $post->ID . '<br />';
endwhile;
echo 'Done!  Everything saved!';