Skip to main content
3 of 3
added 19 characters in body
kaiser
  • 50.8k
  • 27
  • 150
  • 244

If you know the ID of the author you can use wp_insert_post specifying the ID and the author ID to it.

$id = $post->ID; // change this to whathever
$user_id = '4'; // change this too

$the_post = array();
$the_post['ID'] = $id;
$the_post['post_author'] = $user_id;

wp_insert_post( $the_post );

The trick is to specify the ID to update the post. See wp_insert_post().