I'm trying to get the number of user who registered today.
I've tried this:
$args = array (
'role' => 'Subscriber',
'meta_query' => array(
array(
'key' => 'user_registered',
'value' => '2015-01-13 00:00:00',
'compare' => '>=',
'type' => 'DATE', //also tried DATETIME, TIME
),
),
);
$user_query = new WP_User_Query( $args );
$user_query->total_users;
But the results is always 0.
This works:
global $wpdb;
$results = $wpdb->get_results( "SELECT * FROM `wp_users` WHERE `user_registered` >= '2015-01-13 00:00:00'");
echo count($results);
But shouldn't WP_User_Query() be able to do this. Am I doing something wrong with the args?