I have a PHP program to create a site/blog in a networking enabled WordPress. After the site creation, I want to create a post using the same PHP program.
If I use wp_insert_post()
function, it’s creating the post in the main site/blog, not in the new site/blog I created. I also tried using switch_to_blog()
before calling the wp_insert_post()
but no luck.
I got the answer for this… The culprit is $blog_id, the moment I changed the variable name to $new_blog_id, it started working. Thanks
The following used as Must Use plugin does the job: