[wp-hackers] get_user_meta returning empty string

Martin Widmann widmann.martin at gmail.com
Wed Nov 24 17:08:58 UTC 2010


I think the behavior is correct. You tell the server that you want to get a single value, that's why you get an empty string when nothing matching your criteria can be returned instead of an array.

On 24.11.2010, at 17:11, 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
> 
> 
> 
> 
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list