[wp-hackers] get_user_meta returning empty string

Muro, Matthew mmuro at advance.ua.edu
Wed Nov 24 17:16:11 UTC 2010


Never underestimate the power of posting.  The problem ended up being that someone using a different $table_prefix other than "wp_" wouldn't have the meta_key "wp_capabilities".

Let me know if I'm jumping to conclusions here, but I'm able to reproduce the error.

Matthew Muro
Web Developer
UA Office of Web Communications



On Nov 24, 2010, at 10:11 AM, Muro, Matthew wrote:

Hey guys,

I'm using the get_user_meta function to grab the wp_capabilities of a user, but in some cases it's returning an empty string instead of an array.

Here's how I'm using the function:  get_user_meta( $current_user->ID, 'wp_capabilities', true );

Depending on the server, a successful response is something like array(1) { ["administrator"]=> string(1) "1" } or array(1) { ["administrator"]=> bool(true) }.  However, the cases where it fails returns this string(0) "".

According to the Codex, it should at least return the value I'm looking for.  What would cause get_user_meta to return an empty string?

Thanks,

Matthew Muro
Web Developer
UA Office of Web Communications








More information about the wp-hackers mailing list