Hook that get’s triggered when the author of a post is changed

There is no special hook to author change.

But you can achieve it by using post_updated hook.

Example:

add_action('post_updated', 'prefix_on_update_author', 10, 3);
function prefix_on_update_author($post_ID, $post_after, $post_before)
{

    if ($post_after->post_author != $post_before->post_author) {
        // author has been changed
        // you can add your own hook here or write your code
    }
}

Here is the codex reference.

Leave a Comment