Update all wordpress posts’s title and content then display them in a table

I am trying to update all the wp post title and content then shows 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 post, 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.?

Read more here:: Update all wordpress posts’s title and content then display them in a table

Leave a Reply

Your email address will not be published. Required fields are marked *