[wp-hackers] get_user_meta returning empty string

Andrew Nacin wp at andrewnacin.com
Thu Nov 25 07:38:24 UTC 2010


On Wed, Nov 24, 2010 at 4:53 PM, Otto <otto at ottodestruct.com> wrote:

> On Wed, Nov 24, 2010 at 2:44 PM, Muro, Matthew <mmuro at advance.ua.edu>
> wrote:
> > 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.
>
> $user = wp_get_current_user();
> var_dump ($user->roles);


Fair warning: By failing to use the API here, and instead relying on
get_user_meta(), you're guaranteeing that your code will be broken in a
future release of WordPress.


More information about the wp-hackers mailing list