To copy a post from one blog to another you can do something like this:
function copy_post_to_blog($post_id, $target_blog_id) {
$post = get_post($post_id, ARRAY_A); // get the original post
$post['ID'] = ''; // empty id field, to tell wordpress that this will be a new post
switch_to_blog($target_blog_id); // switch to target blog
$inserted_post_id = wp_insert_post($post); // insert the post
restore_current_blog(); // return to original blog
}
Related Posts:
- Create mobile site with same content just different theme
- Querying posts from multiple sites in a network?
- How to hide or remove unwanted widgets on Multisite installation?
- How can I diagnose a slow WordPress admin?
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- WP-Admin not working properly at WordPress multisite with subdirectories
- Security in WordPress plugin development
- Hide a theme on list of themes in wp-admin without editing core files
- Difference Between Admin and Super Admin in Database
- wp-admin slow in multisite
- Don’t allow access to wp-admin but allow admin-ajax requests to be fulfilled on frontend?
- Timeout While Upgrading Network in Multi-site
- Uploading Images to Multi-Site Causes Failure to HTTP Error
- Multisite wp-admin redirect loop
- WordPress network (multisite) /wp-admin/ redirect loop (ERR_TOO_MANY_REDIRECTS)
- My subsites accidentally went from one multisite network to another. How do I change it back?
- Redirect loop (only for multisite network admin)
- Manipulate list of themes in wp-admin
- Creating a Post form outside of the Admin
- Subsites in Multisite installation throwing 404 error on wp-admin in IIS 7
- How to remove Broken Link Checker widget from admin menu
- How to set Active plugins as the default screen?
- Why can’t I delete original user in multisite? Options for manual removal
- Multisite network admin – URL / redirect error
- Cookie nonce is invalid – Multisite
- WordPress mutisite migration
- Why does the My Site dropdown show only a single domain?
- Super admin access to a forgotten WP instance?
- Iframe being removed only for some users when publishing a page
- WP Multisite with Domain Mapping : Preventing User Access to Dashboard
- 2 website 1 database… Local to online
- Moving wp-admin folder to a different host in a multisite environment
- Site’s admin created with wpmu_create_blog accessible only on 2nd attempt
- How to query blogs posts of WordPress sub domain?
- Is There A Plugin to Create WP Multisite Installs programatically
- Can’t log in to wp-admin after setting up Multisite
- WP MS: How to query over the network
- Infamous admin login redirect
- WordPress multisite second site admin resulting in too many redirects error
- Get latest posts from multisite
- Multisite wp-admin redirecting to main wp-admin using NGINX
- WordPress Multisite: Login to all subsites at once
- How to Add Super Admin for WordPress multi-site
- Get posts by user role in a Multisite
- network admin pages not linked to correctly
- Multisite – cannot remove specific sub-menu its parent menu. All sub-menus disappear
- How to have same admin login for more than one site?
- WP Admin Panel for Multi-site install not loading JavaScript for one Subdomain
- Backend freezing on certain pages of a subsite
- Admin user getting redirected to /wp-admin/user
- Pages redirect me to the homepage
- Many big issues in the website, WP_Debug not showing
- What could be changing my WP password and blocking plugins from installing?
- How do I remove/delete an old super admin user?
- How will self-hosted WordPress work with Google Page Speed Service?
- What is the best way to load the WP environment in a subdomain of my multisite WordPress install?
- Benefits or Problems for using Sub-Directory vs Sub-Domain install of WP Network
- What methods should be used to fend off splogs in a multiuser install? [closed]
- WordPress 3 Multisite using subdomains.- DNS on Cpanel question
- How to Login Once to an Entire WP Multisite Network
- NGINX Multisite Rewrite rules
- On Multisite: Loop to Show First Four Images of Recent Posts Across Network
- 500 error when using virtual host
- Has anyone seen a ‘visual anatomy’ type graphic of the Buddypress plugin?
- How to configure DNS If I use the plugin yet-another-multi-site-manager?
- Problem in Internationalizing a plugin built for network level usage
- Custom rewrite rule sends 404 header on multisite
- WordPress multisite subdirectory on nginx behind reverse proxy
- How to use the “domain_exists()” function
- Avoid having infinite loops
- WordPress Multisite/Network – How to use a subdomain as main blog and subdomain for child sites
- Multisite installation not in root – how to make live?
- Multisite – One user allowed access to all sites?
- Can’t view network plugins.php or upgrade-core.php on multisite
- Multisite: Retain awareness of what posts came from which site?
- Merge Multisites with Shared Network Media Library
- Multisite – Looking for ideas to best manage a main site change
- Networksite/multisite is disabled ?, Why?
- My subdomain on WordPress Multisite has gone
- Multisite WPLANG won’t save
- How to display users with posts published between two dates (Sorted by Post-Count) [Multisite]
- Create a CSS file in plugin folder when theme is activated
- WP MultiSite: Can’t select database error after changing to new domain
- switch_to_blog() not functioning while querying post_types, Why?
- Redirect Plugins.php to New Plugin Page
- Different site different div content – Multisite
- Multisite sites output on a single page
- can’t create user without email for an author after converting single site to multisite
- Multisite cookies are being shared across domains unwanted
- Redirect Function Prevents Images from Showing in Front-end Media Uploader
- WordPress multisite redirect one custom non www domain to www
- Max number of sub folders
- wordpress multisite config issue needs help
- How to force WP to create a users table in multisite configuration?
- Creating a stand-alone site from a WordPress sub site
- Multisite read_more link displays URL twice
- WordPress and multisites, the rigth choice?
- Trying to create site-wide Active Directory sync with Multisite
- get_category_link() or get_tag_link() return wrong category/tag base in wordpress multisite
- Multisite subdomain microsite on secondary domain