$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 the site.

$base_prefix
The original prefix as defined in wp-config.php. For multi-site: Use if you want to get the prefix without the blog number appended.

(emphasis added)

Leave a Comment