Apparently a global variable is not properly updated. I found a fix based on blackriver’s reply here, it’s a little ugly but it works:
add_action('switch_blog', 'fix_wpmu_create_blog', 10, 2);
function fix_wpmu_create_blog($new_blog_id, $old_blog_id){
global $wpdb, $wp_queries;
if($wp_queries && defined('FIX_WPMU_CREATE_BLOG')){
$old_pattern = $wpdb->base_prefix.$old_blog_id.'_';
$new_pattern = $wpdb->base_prefix.$new_blog_id.'_';
$wp_queries = str_replace($old_pattern, $new_pattern, $wp_queries);
//echo '<pre>';
//print_r($wp_queries);
//echo '</pre>';
}
}
and
define('FIX_WPMU_CREATE_BLOG', true);
somewhere in the code that’s using this function.
If someone has a better solution please post it so I can accept an answer 🙂
Related Posts:
- How to delete post revisions?
- Perform action on WPMU blog deletion
- Changing Multisite themes on mass
- Upload path/URL weirdness for the main blog of a multisite/network setup
- WP_Site_Query vs. WP_Network_Query in WordPress 4.6
- Multisite/network–automatic self-registration, blog setup
- Sitemap Plugin for WordPress Network
- Restrict users on multisite WordPress install
- Possible to make custom role in multisite that can add sites?
- Multisite installation combining subdomains and subdirectories
- How to find site id for one site on a multisite
- 3.9 breaks multisite
- Add site options UI in Multisite Sites > Infos page
- 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
- Max number of multisites
- Get users primary blog URL in MultiSite
- WordPress MU Domain Mapping Customizer Error
- 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
- Multisite Redirect issue
- 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
- Can you manage multiple domain names from a single WordPress multisite network?
- 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
- 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?
- WordPress multisite proper prefix attribution
- Is it possible for a child-site of a multisite to be a multisite itself?
- WordPress stuck in deleting user
- 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
- Display site description instead of site name
- Multiple subsites in a single wordpress installation
- How to sync roles across Multisite?
- WordPress multi-site: How do I create the home page, the root URL?
- Multisite Subdirectory Site Dashboard redirect loop
- WordPress Multisites or Multiple WP Single sites?
- Is it possible to query posts with tax queries after multisite switch_to_blog() function?
- 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
- Give users acces to admin a single post or set up WP network?
- WP-Cli Error When Mapping Multisite Subdomain
- WordPress Multisite for multi-language
- WP Multisite Sub-Domain Error
- Downloading customized theme from wordpress
- WordPress multisite condition for certain blog_id’s
- the menu of the network does not display my second website
- Multisite – site user limited only for this site
- Get variable from previous blog while using switch_to_blog
- Should i use multisite for my business?
- WordPress Network with SSL for multiple domains
- Nginx rules for subdomain multisite install (Bedrock)
- WP Admin Panel for Multi-site install not loading JavaScript for one Subdomain
- WordPress multisite not working
- multisite detect subsite blog number
- How to Create WPMu New User?
- New multisite redirects to main site
- How to disable style filtering in post?
- Is it possible to create a login for restricted visibility?
- Create a Network of Different websites with wordpress
- WP Multisite: Do a function after blog is activated
- multi-language multi-site with REST API
- How to make Multisite global login that redirects to correct subsite after login
- Advice on WP site structure using multisite
- How to login Separately in each blog?