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?
- Wp-admin wrongly redirecting on multisite
- Unable to change blog language in multisite
- Multisite logged into one wp-admin, move to another sites wp-admin asked to login again
- Memory growth with new additions to WordPress Multisite
- How to run an activation function when plugin is network activated on multisite?
- Specific upload folder for PDFs in custom Post type in WP multisite
- WordPress Multisite: Adding actions to only one site
- wordpress multisite, how to keep user on subdomain throughout registration process?
- On WP Multi sites how many sites…!
- Auto create pages on WordPress multi site register
- Get source from the_post_thumbnail
- How do I maintain static directories on multisite subdomains?
- Custom Post types and Custom fields in Multisite
- Login on Multiple Sub-Domains without Multisite
- Prevent images on self-hosted WordPress from being served from WordPress.com
- WordPress multisite fails to create a new site in the network
- Changing path for media upload folder in wordpress multisite
- Viewing / Editing A Multisite website after domain has expired
- Bulk Move Users from one site to another within a network ( Multisite )
- Multisite – getting a 404 for additional site created using subdomain install
- muliple wordpress multisite installs on the same sever
- how to create wordpress network with multiple wordpress installations
- get_last_updated() not working – multisite loop
- Programmatically creating site in a network
- What happens when someone goes to the root URL in WordPress Multisite?
- Migrate single site to Multisites with plugins, cPanel and already working subdomains
- how to install wordpress HyperDB
- Multisite Redirect for Home Page Only
- 404 not working on main site on multisite
- add_blog_option blog ID
- Cannot see dropdown shortcut to site dashboard in WordPress network why?
- How can I install WordPress as blog provider , stable?
- Automatic creation of mutisite blog outside of the admin
- List all sites created in network and get the language used for each site
- Automatically add a registered user on the wordpress multisite network even to just one other site
- Redirecting specific sites to HTTP in WordPress Multisite
- WordPress Multisite VMware copy for dev use not allowing loggin
- Create new multisite from existing and keep domain?
- How to mapping a WordPress MultiSite Network Subdirectories to new domain with all subsites
- Synchronize wordpress site between two different servers
- How do I setup WordPress Multisite in it’s own directory?
- Configuring Multisite with subdomains
- How do I remove ‘www.’ from all internal links in self-hosted multisite?
- How do I make a copy of WordPress to other folder
- MU Domain mapping
- WordPress multisite with subdirectories always redirects to mainsite
- Can i use the same content in two websites? one is the main website and one is directory website