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

John Blackbourn johnbillion+wp at gmail.com
Sat May 11 21:04:49 UTC 2013


On 11 May 2013 21:51, David Anderson <david at wordshell.net> wrote:
> 1. Why does WordPress do this? On the face of it, it seems like a gross
> layering violation - table keys depend on the names of tables. But the WP
> core coders are smart guys, so there must be a reason.

Yeah it's not a good convention.

The reason it's like this is to support entries which can have
different values on different sites in a Multisite network. For
example, in Multisite a user can have different privileges on
different sites within the network. Each site has its own database
prefix (wp_1_, wp_2_... wp_n_) and the user meta key is based off of
this.

> 2. Are there any others that anyone knows about? Any other hidden hazards to
> changing your table prefix?

These are the others that I know of. There may be more though.

`wp_X_user-settings` and `wp_X_user-settings-time`, used to store your
user settings on a per-site basis
`wp_X_dashboard_quick_press_last_post_id`, used to store the ID of the
most recent QuickPress post
`wp_X_user_level`, only present for backwards compatibility with the
old user level system

John


More information about the wp-hackers mailing list