I’m writing a script to import data into wordpress from a text file.
The data needs to access posts, users, custom fields and post meta data.
To import it, I’m looking up the author in the user table, fetching the ID if it exists (and can’t generate one if it doesn’t), then inserting the post data, adding the post meta and fetching remote images to insert and add those as post meta data as well.
I’m replicating data from an existing site the client owns in ASP.net and pulling it into wordpress for them, however, I can’t quite work out how to programmatically add the user. My intention was do this without calling a public page with a wordpress function, but simply to try to replicate the appropriate SQL used.
Could someone direct me to the functions needed that perform the queries to insert a new user?
Thanks,
Insert a new user. (assuming the new database uses the standard table prefix of ‘wp_’)
Get the insert id then set the users role & level e.g. Subscriber