[wp-hackers] Why do some user meta entries use the table prefix in the, meta key?

David Anderson david at wordshell.net
Mon May 13 12:06:17 UTC 2013


On 13/05/13 13:00, John Blackbourn wrote:
> The database prefix with the blog ID appended acts as a UUID within
> the given database. This allows you to share your users and usermeta
> tables between WordPress installs in the same database, because each
> has a different database prefix.
>
> Example: I have two Multisite installs which share a users and
> usermeta table. The resulting usermeta keys would be, for example,
> "foo_{n}_" for one site and "bar_{n}_" for the other. If the database
> prefix wasn't prepended there would be key collisions.
>
Thanks... what I didn't understand was, how/when does that sharing of 
the tables actually happen? For it to happen, one WordPress install 
would have to access tables that are not prefixed with its own 
$table_prefix, but prefixed with something else. I didn't know that 
WordPress had code to access a different set of tables than the one 
specified in $table_prefix. Or is it something that's not coded in 
WordPress, but someone could use some hooks to achieve if they wanted to?

David


More information about the wp-hackers mailing list