Here is my case:
I am trying to get all users with some value related to a specific meta key. In other words, I don't want to select users that have nothing on that meta key (mps_finalDate).
So here is my code:
$users = get_users(array( 'meta_key' => 'mps_finalDate', 'meta_value' => '', 'meta_compare' => '!=', ));
Which works the same as
$users = get_users(array( 'meta_key' => 'mps_finalDate', ));
But the problem is: this code is selecting users that once had some value on this meta field, even if now they have nothing on it. It seems that the
update_user_meta( $user_id, 'mps_finalDate', trim( $_POST['mps_finalDate'] ) ); I am using in my code is not deleting the previous value on the db, thus causing this issue.
In conclusion: the above code is not selecting a user that never had a value on the meta key field
mps_finalDate(which is desired), but it is selecting a user that once had a value on it, even if now this value is