I have more than 50 sites on the same server.
I wrote a separate PHP script which will gather post and try to add them into all 50 wordpress site's databases.
I am using wp_insert_post() to insert the post into the database.
But it only insert all the posts to first wordpress site.
Can anyone please tell me how i can change the database connection at run time so i can insert one article to all my wordpress databases using wp_insert_post() function.
I will be very thankful.