Title: PHP code to add Author
Last modified: August 21, 2016

---

# PHP code to add Author

 *  [jkellerer](https://wordpress.org/support/users/jkellerer/)
 * (@jkellerer)
 * [12 years ago](https://wordpress.org/support/topic/php-code-to-add-author/)
 * Hi,
 * I am wanting to check the meta-data in a post, if it exists, then I want to automatically
   add a certain user.
 * What code can I use to just add a user, by ID, to a post by ID, and as many of
   them as I want.?
 * Also I think I might need to be able to check by post ID what users are currently
   assigned?
 * I believe I can figure out how to do the if statement.
 * Any help would be great!
 * Thanks,
 * [https://wordpress.org/plugins/co-authors-plus/](https://wordpress.org/plugins/co-authors-plus/)

The topic ‘PHP code to add Author’ is closed to new replies.

 * ![](https://ps.w.org/co-authors-plus/assets/icon-256x256.png?rev=2945095)
 * [Co-Authors Plus](https://wordpress.org/plugins/co-authors-plus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/co-authors-plus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/co-authors-plus/)
 * [Active Topics](https://wordpress.org/support/plugin/co-authors-plus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/co-authors-plus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/co-authors-plus/reviews/)

## Tags

 * [automatically](https://wordpress.org/support/topic-tag/automatically/)
 * [edit](https://wordpress.org/support/topic-tag/edit/)
 * [Modify](https://wordpress.org/support/topic-tag/modify/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [jkellerer](https://wordpress.org/support/users/jkellerer/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/php-code-to-add-author/)
 * Status: not resolved