[wp-hackers] Multisite options

David Anderson david at wordshell.net
Mon Jan 20 21:13:36 UTC 2014


On 20/01/14 20:32, Mike Burns wrote:
> I don?t think there is a cleaner way to access that value then `$wpdb->base_prefix`.  I wouldn?t use `$wpdb->get_blog_prefix()` ? semantically that method is intended to retrieve the prefix for a specific blog, and passing 0 is a hack that won?t always work due to the issue you discovered.
>
Having looked at and thought about this more, I think you're right. 
Whatever the purpose of the 0 == $blog_id check in get_blog_prefix() was 
when the coder added it, even if it was intended to be a way to get 
$wpdb::base_prefix, this corner-case shows that it doesn't always work.

I've filed this ticket in trac, with a patch whose effect is to make 
wpdb::base_prefix explicitly public, so that coders can know that 
they're safe in relying on it: https://core.trac.wordpress.org/ticket/26887.

David

-- 
UpdraftPlus - best WordPress backups - http://updraftplus.com
WordShell - WordPress fast from the CLI - http://wordshell.net


More information about the wp-hackers mailing list