I am using three site multi-site installation.

When I use $wpdb->base_prefix some time it gives network site prefix instead of giving base site prefix. Any one face this problem? Can you please give any suggestion?

  • 1
    Are you looking for $wpdb->prefix instead? If you can post some of the relevant code, we may have a better chance of helping you.
    – Pat J
    Commented Oct 20, 2016 at 14:03

2 Answers 2


$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:

The assigned WordPress table prefix for the site.

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)


Try $wpdb->get_blog_prefix like below:

$base_prefix = $wpdb->get_blog_prefix(0);

And use $base_prefix as base prefix.

Let me know if this is not work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.