It looks like you’re using a custom meta field but searching default meta attributes.
https://codex.wordpress.org/Class_Reference/WP_User_Query
WP_User_Query might be a more robust solution.
So it would look like something like :
$args = array(
'meta_query' => array(
'relation' => 'AND',
array(
array(
'key' => 'mps_finaldate',
'value' => '',
'compare' => '!='
),
array(
'key' => 'mps_finaldate',
'value' => null,
'compare' => '!='
)
)
)
);
$user_query = new WP_User_Query( $args );
EDIT:
WP_User_Query
is a wrapper for the get_users
function you were using but it, as a wrapper, also is going to do the work of the get_userdata
function
This is great and detrimental for 2 reasons (each)
Great: it can be hooked (someone edit me)
Great: code longevity is sustained because it is core api use
Detrimental: anyone and everyone’s plugins can also hook
Detrimental: anyone and everyone’s plugins can also hook
I’d go the route of using the wp_user_query
class if only because the arguments are structured and documented well (but I’ll stay for the longevity benefit of the approach being wp_core api)
your mileage may vary