I'm trying to get all users assigned to a custom usermeta. I know that get_users() is supposed to work; however, it doesn't seem to be working. What I have is a usermeta storing a category ID and I'm trying to use 'meta_value' => $cat_id to query the database. So this is the code I have:
$args = array( 'meta_key' => 'custom-usermeta', 'meta_value' => $cat_id ); $users = get_users( $args ); and here is how I'm saving it:
update_user_meta( $user_id,'custom-usermeta',$cat_id); $cat_id is an array.
But this isn't working. What I've figured out so far is that the meta_value expects an unserialized value. How can I get that to work? I tried the 'meta_compare' => 'LIKE' but then that just about grabs everything (because of the way Wordpress serializes the values). Is there anything else I can do to fix this?