I am trying to update all the WP post title and content then show the just updated post to a table. I am using the following code but it does not work:
$args = array(
'post_type' => 'post',
'numberposts' => -1
);
$myposts = get_posts($args);
foreach ($myposts as $mypost){
$mypost->post_title = $mypost->post_title.'test';
wp_update_post( $mypost );
echo "<td>".$mypost->post-title.""."</td>";
}
Also, as I am trying to update all the posts which might have timeout error or server timeout. How to display this action with AJAX or jQuery or anything to perform one by one then sleep?