I want to update My WordPress Post right after publishing the Post. The code given below updates the post but my dashboard keeps loading until timeout error. I want to add some more content after the post is created.
function updatemypost( $post_id, $post,$update ) {
$mydata = array(
'ID' => $post_id,
'post_content' => 'New Data..',
);
wp_update_post( $mydata );
}
add_action( 'publish_post', 'updatemypost', 10, 3 );