You probably need to switch your context to the subsite in which the posts need to be created. Have a look at the switch_to_blog() and restore_current() functions in wp-includes/ms-blogs.php See http://phpxref.ftwr.co.uk/wordpress/wp-includes/ms-blogs.php.source.html#l437
Related Posts:
- How to migrate subsite from dev multisite to production multisite
- WordPress Multisite allow site admin to add user without email confirmation
- Listing of all uploaded files in network sites
- Troubleshooting a Network site displaying a blank page [closed]
- Add new column to sites page
- Wildcard subdomain for the same site
- Is there a filter to define the OG image on a given post?
- How to reset passwords for all users on a network using wp cli
- WP-CLI methods for get_current_blog_id, get_blog_details or $wpdb->prefix
- WordPress Multisite with NGINX, subfolders, and FROM a subfolder
- How to consolidate all sitemaps in a multisite network?
- How to modify author base slug with groups and slug to use nice_nickname?
- Multisite installation combining subdomains and subdirectories
- How to find site id for one site on a multisite
- 3.9 breaks multisite
- Stop wordpress from sending out moderation emails
- BP Multi Network & Members Directory [closed]
- Need to manually regsiter user, send the password and retreive their user ID
- Deleting sites and users automatically in multisite
- Make default new sites https (multisite)
- How to move theme directory but not plugins/uploads out of WordPress root directory?
- Sharing Header Components Across Multisite
- How to get a user role of a specific blog in multisite?
- Issue converting single site to multi-site – blogs.dir folder not created
- Logout issue with new Domain on WP Multisite
- Subdomain and subdirectories together in one installation
- WordPress Installation for multi-domains with nginx and php-fpm
- Get users primary blog URL in MultiSite
- Redirect subdomain homepage to domain specific page in wordpress multisite
- Make WordPress Search for Both Main Domain and Subdomain
- Is it possible to setup multiple sites with a common pool of posts?
- Not able to access dashboard of subdomain
- How to stop unlink images when remove a site or user
- Multisites, upload issues, and iOS!
- How to allow WordPress users create sub-website or mini-website under my domain with any basic site builder?
- Multisite new sites not found(404), main site still works [closed]
- How to get option values set from all sites within a Multisite setup?
- Stop WordPress Entirely and Run My Own Code
- Retrieving multisite blog IDs, somehow failing to foreach them properly
- How to host blog on separate domain from main site
- What is meant by Multisite in WordPress?
- Allow Author on Site A capability to upload files on Site B in Multi Site
- How to use a Wildcard SSL with WordPress Network?
- Migrating wordpress multisite and domain mapping plugin
- WordPress Multisite – Can 2 domains share a database of users?
- Can you create a local wordpress network / multisite install on a mac with subdomains?
- How to solve this issue
- What is the way to share data between sites in a multisite
- ERR_TOO_MANY_REDIRECTS when i config my subdomains
- Subsite access without being a member of the subsite in wp multisite network
- Redirect loop after activating wordpress multisite feature
- Error: reassigning content to a different user is not supported on multisite
- Run additional service on domain with WordPress Multisite?
- Development of new theme and rollout on multisite
- WordPress Network (multisite) — how to ensure each site has their own admin URL?
- Is it possible for a child-site of a multisite to be a multisite itself?
- metaboxes disappear on saved pages
- How to show only blog-domain instead of the whole permalink in the loop
- Multisite installation on an existing single installation
- Multisite Sub domains not working
- Multiple subsites in a single wordpress installation
- How to sync roles across Multisite?
- Multisite Subdirectory Site Dashboard redirect loop
- WordPress Multisites or Multiple WP Single sites?
- Is it possible to disable html code error auto fixing feature by wordpress 4.9.1?
- LimitInternalRecursion error
- Should I use Multi Site to achieve different designs for different sections?
- User registration is currently not allowed
- $_SERVER[‘SERVER_NAME’] in WP_SITEURL
- WPMU on MySQL limited to 1GB of space?
- Two installs conflicting – Pages redirecting
- Set my own password when registering a multisite user or site
- Efficient way to fetch all archived WPMS blogs
- Give users acces to admin a single post or set up WP network?
- How to fix redirection of Post/Page of wordpress inside the wordpress?
- Multi Site Language switcher
- How to use the same “wp_posts” table for different subdirectories in the same DB?
- What is the proper way to merge 2 WordPress blog instances
- In Multisite – main site blog post should be display in minisite or subsite
- Multisite WordPress doesn’t work properly on virual hosts
- Installing other applications alongside WordPress multisite subdomains
- Multisite Dashboard not working
- Multisite (with nested paths) wp-admin redirect loop
- Where does WordPress Mu DB store the link of network admin dashboard
- wordpress multisite – handle Database
- Importing Posts into New Website with Same User ID’s
- network admin pages not linked to correctly
- change database to multisite in localhost
- Styles not being applied to multisite setup
- Multiple domain with one database
- Right approach in doing this signup process
- Multisite main theme changes do not show up in child sites
- Editing links to new Site url when user Creates a New Site
- Access from template info of another blog (in the same network)
- 4th Network Site Database Errors?
- WordPress MultiSite Link Cloaking/Redirect Solution?
- How to disable admin access on new site registration for user in Multisite?
- Maximum Execution Time Exceeded Error while creating New Site in Multisite, Increasing Time Not working
- Moved WP Multisite, cannot access sites
- What could be changing my WP password and blocking plugins from installing?