I have been trying to work out just where in the massive jungle of WordPress include classes the usermeta table is joined onto the users table and if so, how does it work?
The one confusing thing about the usermeta table to me is that it is using key/value fields for the database fields and not actual values like first_name or last_name. How does WordPress know which fields to pull out by default and are there hooks, actions and filters for adding and retrieving data from the usermeta field?
I’m not 100% what you are asking, it seems like several questions? But here goes:
For example:
As for adding hooks I think this answer might be what you are looking for?
UPDATE
Based on some follow up comments I’ll add:
The function
get_user_metavalues($user_ids)
from/wp-includes/user.php
will return an array of user data arrays.The function
get_userdata()
retrieves user values usingget_user_metavalues($user_ids)
from/wp-includes/pluggable.php
and returns a user data object.User Meta is managed through the generic metadata functions found in
/wp-includes/meta.php
so if you are looking for a SQLJOIN
between wp_users and wp_usermeta you are not likely to find one. That file includes these functions: