You can loop through each of the $posts
and update the post_content with update_post_meta
.
<?php
foreach( $posts as $p ) {
update_post_meta( $p->ID, 'post_content', 'YOURCUSTOMEDITS' );
}
?>
edit: if you want to use wp_update_post, it’d look like this:
<?php
foreach( $posts as $p ) {
$my_post = array(
'ID' => $p->ID,
'post_content' => 'New text',
);
// Update the post into the database
wp_update_post( $my_post );
}
?>