So, I solved this by doing a regular get_user() and putting it inside a for loop of years and ran the get_user on each year.
$currentYear = date('Y');
$years = range($currentYear, 1900);
foreach($years as $year){
$TotalArray = get_users(array('meta_key' => 'date_of_birth', 'meta_value' => $year, 'count_total' => true, 'meta_compare' => 'LIKE', 'role__in' => 'members'));
$thisYearsTotal = count($TotalArray);
//echo some <tr> and <td> html for formatting.
}
Related Posts:
- Query posts by post type, author and post meta
- Can wp_query return posts meta in a single request?
- compare meta_query in get_posts arguments
- How can I use order_by to order by two meta_keys without excluding posts that don’t have those keys initialized?
- Function in array as arguments for WP_Query
- WP_Query to show post from a category OR custom field
- Getting attachments by meta value
- Getting all user metadata from user
- meta_query where value is equal to given value
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- Sorting Posts by custom field
- WordPress altering my custom query, How to fix it?
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Order by meta_key in custom post type doesn’t affect the query
- Filter user list that meta_value is empty
- Query wp_usermeta alongside wp_users
- Custom Field sort not working (WP 3.8.1)
- SQL User Query by Multiple Roles using PHP
- Filtering posts by custom field value not working
- getting posts and number by specific meta value in multiple meta
- Order Posts by meta value AND published date
- WP User Query get all authors with last name starting with specific letter
- wp_query add arguments using array_push if variable met
- Sort users by “birthday” using WP_User_Query
- Group WP_Query by meta_key date
- How To Fix WP Query Returns Results But Shouldn’t?
- Get posts for which a custom field is not present, with get_posts
- Output an array of terms for a ‘tax_query’ => array()
- exclude posts with a specific custom field and value
- How to Filter Posts by Custom Fields?
- Hide Administrators From User List except current user (administrator)
- Fetch Record based on meta key dates
- Orderby is working with one query but not with other
- Import wp users via one click demo option
- meta_query BETWEEN, but the range is stored in the custom field
- Get a list of posts with associated meta_value
- Dynamic User Id
- Adding multiple meta_key fields as orderby options to a WP Query via a function
- Large AND OR query timing out
- meta_value_num not ordering all items
- Categorising search results based on Custom Fields
- WP Group posts by year(desc) > month(desc) > date(asc)
- Search posts missing a particular custom field
- wp_query get data from advanced custom field in wordpress
- How to compare a date in custom field with today’s date in custom WP_Query?
- Get multiple users with meta value in one query and populate WP_User class
- WP_Query Meta_key is text value and need to sort as numeric not working
- filter wp_query result with custom field values
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- Display if author page is author page of current user
- WP ForLoop to compare meta information of posts to determine what post to display
- Display posts with specific value first in query
- get_posts custom field
- wp_query posts with custom fields number smaller than
- Retrieve select tag custom values from array and display them in current page with wp_query?
- How to use a dropdown to filter posts by custom field
- Create one-use post dynamically, add to main query, do not insert post (user profile view)
- Query only displays one page_id
- Querying a large number of posts including their custom fields data
- Display post meta conditionally based on it’s value
- add_query_arg to compare and display events from a certain date
- Query to get last posts from authors of blog
- Query multiple post types, but different order for each
- Order by the first array within a meta_query
- Query ACF relationship field – Comparator IN – Value array
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- How do i create a custom post query when the meta value is an array?
- display ACF repater field in archive page
- How to use the Term Object from a custom select field in a query
- Random users always showing same 8 users
- WP Query – grouping posts by same meta key, adding together values from another key
- Retrieve all custom field values of a specific custom field metakey as an array, inside WP_Query
- Categories In English version showing not canonical URL, instead shows query search result
- Comparing Meta Field date in WPQuery using Meta_Query?
- Query against multiple locations within single custom post type post
- WP_Query, ACF field and array
- Problem with my loops
- Order 2 meta_queries differently in WP_Query?
- Order by Date Custom Field
- Sort posts on custom field AND after that sort on date?
- How to query 5 users in random who have published more than 10 posts
- How to query users by post count no less than 10
- using custom meta user data to run queries in WordPress
- Order posts by title and custom field value?
- Meta key in wp_query bug?
- Wrap group of wp query posts to parent div by date/year
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Order Custom Field by Price
- WP_Query to show post from a category OR custom field – Not 100% answered
- Sorting Posts with meta value not working
- Custom search (wp query by custom fields)
- How do I display posts with specific value in a custom field into my loop?
- Custom Search Query – include only custom fields and title
- Get users query makes the site loading time too big?
- Get posts by meta value except one post [closed]
- WP query with variables gives no result for specific user
- WP_Query – order with usort by custom meta
- WP_Query sort by ACF date field (newest first) with blank dates first
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string