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
- Conditional operator OR not working with custom fields
- Display if author page is author page of current user
- Get user first name from custom endpoint
- WP ForLoop to compare meta information of posts to determine what post to display
- WP_QUERY with group by with custom fields
- How to order posts on each different category?
- Intiger meta value with ‘>=’ returns posts with lower value
- Display posts with specific value first in query
- get_posts custom field
- Get every post with value in meta key
- Using get_posts to get posts based on a checkbox value with Advanced Custom Fields
- wp_query posts with custom fields number smaller than
- Posts query according to meta box date
- create metabox to activate slider
- Query posts using less 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
- Order WP_Query results by meta key value in custom query
- Storing an array of objects related to each user
- Create one-use post dynamically, add to main query, do not insert post (user profile view)
- Excluding posts with certain value of meta_key keeping posts without that meta_key
- 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
- Query using string from custom field as array value
- How to show list of posts with custom field value (a date) that are coming soon
- add_query_arg to compare and display events from a certain date
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- Sorting posts by Multiple custom fields in defined order
- Query to get last posts from authors of blog
- meta_query weird behaviour, static int will work, but not user data
- Query multiple post types, but different order for each
- Order by the first array within a meta_query
- Woocommerce Shortcode which displays a table with product data
- Query ACF relationship field – Comparator IN – Value array
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- 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?
- How to add a “base” filter for all posts visible to visitors on the site?
- Sort custom post by custom field if none order by latest release
- Query pages created by deleted users
- 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
- meta_query is overriding default search
- Trouble with serialized metadata
- Categories In English version showing not canonical URL, instead shows query search result
- Comparing Meta Field date in WPQuery using Meta_Query?
- Getting posts by custom field value
- Query against multiple locations within single custom post type post
- Query post by Category and custom file (ACF)
- Set “editor” role to existing user
- WP_Query, ACF field and array
- Problem with my loops
- Order 2 meta_queries differently in WP_Query?
- Order by Date Custom Field
- ACF Post Object meta-query by title not ID
- 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
- Merge wp-query and get_users
- Order posts by title and custom field value?
- From admin edit user page query either the user_nicename or username field value of the user profile being edited or viewed
- Query by meta value (add a dropdown of all values)
- Get all wp_users sort by metakey
- Order Posts By Custom Field That is an array of objects
- How to create URL parameters to run custom queries?
- Logging search queries for logged-in users
- Meta key in wp_query bug?
- Custom WP_query and integrating into theme file
- Query by Category and Custom Field – Shortcode
- Show subscriber id in loop
- Wrap group of wp query posts to parent div by date/year
- Querying posts with meta key and meta value not returning anything
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Sorting posts by meta values: 2 different orders
- WP_Query with Pagination and orderby meta_value_num showing duplicates
- Order Custom Field by Price
- Mathematical operations on custom field values? (updated)
- WP_Query to show post from a category OR custom field – Not 100% answered
- Compare meta key separation
- WP_Query a custom field value bringing back 0 results
- Sorting Posts with meta value not working
- Order by three custom fields (Y-m-d), then separate into yearly sections
- Custom search (wp query by custom fields)
- Loop through multiple custom fields with increasing number
- How do I display posts with specific value in a custom field into my loop?
- new WP_query using custom fields
- Custom Search Query – include only custom fields and title
- query_posts with sorting on a custom datestamp
- query post based on comparison
- Query posts filter not working
- Query Users by post count, last 30 days and display each users post count according to post type
- Display all custom meta field values from the database using ACF Repeater
- Taxonomy related query not working
- Get users query makes the site loading time too big?