How to tell which database tables belongs to which multisite site

The number you refer to is the blog/site ID, so you have multiple methods of finding out which site it is: Look in the sites table, the number should match the ID, providing you with a URL and title Go to example.com/wp-admin/network/site-info.php?id=insert-number-here and you’ll be shown the network admin UI for that site Consider a … Read more

$wpdb->base_prefix not get parent site prefix in multisite

$wpdb->base_prefix gets the original prefix (ie, the ‘root’ site in a Multisite installation). It was added in Version 3.0.0, right when Multisite became a part of WordPress core. $wpdb->prefix will get the prefix for the current site in a Multisite installation. Per the documentation for the wpdb class: $prefix The assigned WordPress table prefix for … Read more

Prevent “main” WPMU site_url() being returned in functions

Since “WordPress MU is no longer under active development as a separate product“, I don’t recommend using it. Instead I recommend using the setup described in this answer. It’s highly configurable you can choose what WordPress files you want on all your WordPress sites and what you want to store separately from each other WordPress … Read more

Which asset URLs are acceptable in a “vanilla” MU install?

Short Answer example.com/bob/files/picture.jpg is the preferred, canonical URL for images in a WordPress Multisite installation. The two URLs with blogs.dir in the URL are essentially identical, and both leverage the filesystem structure. The path with ‘bob’ exists because you did a sub-directory install, not a subdomain install. Other paths would exist based on your other … Read more

Uninstall script for a plugin in Multisite

Searching inside all uninstall.php files that I have in my hard-drive, I’ve found two that had the function is_multisite(): User Role Editor and Add Code to Head. Both use a $wpdb loop. Simplified: <?php /** * Plugin Uninstall Procedure */ // Make sure that we are uninstalling if ( !defined( ‘WP_UNINSTALL_PLUGIN’ ) ) exit(); // … Read more

Multisite on Windows with wildcard subdomains

There is a plugin for that: WP XAMPP Multisite Subdomains. Unfortunately, there is no English description available. I’ll try that here. The following guide will set up a multi-site under mu.wp with subdomains. 1. Basic Installation Start with a fresh installation of WordPress and XAMPP. Create a network for subdomains. Do not create any sub … Read more