// functions.php
function imnobby_change_author_after_post ( $data ) {
if ( !wp_is_post_revision( $data['ID'] ) ){
$admin_id = 2;
$update_to_author_id = 3; // get_current_user_id();
if ( get_current_user_id() == $admin_id ){
$data['post_author'] = $update_to_author_id;
}
}
return $data;
}
add_filter( 'wp_insert_post_data', 'imnobby_change_author_after_post', 10, 1 );
Related Keywords: Developer, How-to, Solved, WordPress Filter Script, Programming
