Title: [PHP] Change post author?
Last modified: August 20, 2016

---

# [PHP] Change post author?

 *  [jmeit](https://wordpress.org/support/users/jmeit/)
 * (@jmeit)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/php-change-post-author/)
 * I would like to be able to change the author of a post.
    I have the post-id, 
   the user-id that I want to transfer it to, and I have the user-id that the post
   currently belongs to.
 * I need to do this with php, because it must happen automatically. This reassignment
   of authors must occur upon a certain event that I am currently hooking into. 
   Meaning, I don’t want to be doing this in the Dashboard.
 * I can’t find anything on google.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [水野史土](https://wordpress.org/support/users/ounziw/)
 * (@ounziw)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/php-change-post-author/#post-2604088)
 * WordPress has wp_update_post.
 * [http://codex.wordpress.org/Function_Reference/wp_update_post](http://codex.wordpress.org/Function_Reference/wp_update_post)
 * > This function updates posts (and pages) in the database. To work as expected,
   > it is necessary to pass the ID of the post to be updated.
 *  Thread Starter [jmeit](https://wordpress.org/support/users/jmeit/)
 * (@jmeit)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/php-change-post-author/#post-2604304)
 * Thank you SO much! This was exactly what I needed.
    I don’t know why this didn’t
   turn after days of searching google.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[PHP] Change post author?’ is closed to new replies.

## Tags

 * [author](https://wordpress.org/support/topic-tag/author/)
 * [change](https://wordpress.org/support/topic-tag/change/)
 * [change post author](https://wordpress.org/support/topic-tag/change-post-author/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [jmeit](https://wordpress.org/support/users/jmeit/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/php-change-post-author/#post-2604304)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
