[wp-hackers] get_user_meta returning empty string

Muro, Matthew mmuro at advance.ua.edu
Wed Nov 24 20:44:51 UTC 2010


To be honest, all I'm really interested in is the named role of the current user, which get_user_meta or get_userdata return.

Good to know there's more than one way to achieve the same goal.  It'd be great if there was some resource out there that says "this function is faster for getting XX.  If you're looking to get YY, use this other function ZZ."  Doesn't sound too practical, considering all of the things a particular function can do but that's sorta what you and scribu are describing.

Matthew Muro
Web Developer
UA Office of Web Communications


On Nov 24, 2010, at 12:57 PM, <wp-hackers-request at lists.automattic.com<mailto:wp-hackers-request at lists.automattic.com>> <wp-hackers-request at lists.automattic.com<mailto:wp-hackers-request at lists.automattic.com>> wrote:

Oh, and BTW, the global $current_user is already an instance of the
WP_User, for the current user. So if you're talking about the current
user, then you can either just use that global directly, or do this if
you don't like using globals (I don't):

$user = wp_get_current_user();

-Otto



More information about the wp-hackers mailing list