Programatically adding a new author
-
I’m working on a script that automatically adds posts using PHP. I have managed to get my script to add posts using
wp_insert_post()
, but I also want the posts to use the appropriate author, which may not even exist.At the moment I have it set up to use the user ID of 1 (myself), but I would like to also specify a user that perhaps doesn’t exist in my WordPress install. For example say I have 3 author: Bob, Harry and Bill. The post I want to add comes from another author: Jane. Seen as Jane hasn’t been seen before, I need to add her to my WordPress install before I use her user ID in the
wp_insert_post()
function.Is there a ready made function to do this? I tried searching the Codex but I’m unsure of what to specifically search for.
Thanks.
- The topic ‘Programatically adding a new author’ is closed to new replies.