Change WordPress Author by PHP (Frontend)


I want to change the Post Author using a dropdown field, on front-end, when have logged is as admin (or some other rule).

I actually have this code:

[ ‘administrator’, ‘dealer’ ],
‘name’ => ‘post_author_override’,
‘selected’ => empty( $post->ID ) ? $user_ID : $post->post_author,
‘include_selected’ => true,
wp_update_post( $args );

} else { echo “”; } ?>

But when i click submit, it wont save the post..
I really appreciate if someone can explain me how i can save it or auto-save when selected user on dropdown field.

Here is a screenshot:

Thanks for everything.

Read more here:: Change WordPress Author by PHP (Frontend)

Leave a Reply

Your email address will not be published. Required fields are marked *