After some research on wp codex I found my solution. Here I have to change birth_date format during save.
I saved value like yy-mm-dd
this format and changed my meta_query
Here is the code
$studentdata = get_users(
array(
'meta_query'=> array(
array(
'key' => 'birth_date',
'value' => array(
$startyear.'-01-01',$endyear.'-12-31'),
'compare' => 'BETWEEN',
)
),
'role'=>'student'
)
);
print_r($studentdata);
Related Posts:
- How to handle optional end date in compare clause in meta_query
- Arrange Posts By Date In Order Of Closest To The Current Date
- User Relationship
- How to pass user meta_key and meta_value (values as array)
- Query posts with numeric meta values within a given range
- last_name + first_name orderby with meta_query [solved]
- Meta Query Based on Month Range
- how to search all user meta data that have value like “vivek”
- get_users with Serialized Custom Meta Value
- Ordering custom posts by meta field date
- get_user can’t read variable
- Query for user roles and their skills
- How to compare date in post meta value
- wp_user_query with meta_value_num for leaderboard
- WP_User_Query get_count issue with meta_query relation
- How to do a meta query using REST-API in WordPress 4.7+?
- Meta query terribly slow
- meta_query sorting by 2 keys
- How can I query all users who registered today?
- Get result from meta_query() between two numbers
- Using meta_query on pre_get_posts to exclude a particular meta_key value
- WP_Query() show posts that end later than today
- Query between two meta keys
- Archives for custom post type based on a “date” meta value
- How to check a single number value against an array of meta_key values?
- WP_User_Query with combined meta query – not working?
- get_users meta_query
- Meta query with multiple logic (AND / OR)
- Best practice – Meta Query vs. post_clauses for “left join” ordering
- meta_query with multiple values
- Combining Meta_Query key values for one array
- How to add follow functionality to multi-author wordpress site?
- Different page parameters inside query
- Search multiple meta keys at once
- Return posts with specific meta key first, but the rest in alpha order by last name
- meta_query key value from array
- Plugin that would allow WordPress Authors to “follow” other Authors and query “Activity Info” from that
- LIKE %…% Meta Query
- Multiple Values stored as array in Meta Query
- Order by nested named meta queries with ‘exists’ and ‘not exists’
- Documentation for post meta
- Advanced orderby with multiple meta_query
- Using get_terms() with meta_query parameters
- WP_User_Query with meta_query array relation ‘OR’
- Ordering posts by anniversary using only day and month
- delete_user_meta Delete one value out of array
- pre_get_posts filter using numeric meta_query comparison (from dates)
- meta_query problem
- Custom Upcoming Events List for Events Manager Plugin
- Very slow query with meta_query on large database
- How to use meta_query to check if a meta field has something set?
- How can I query on the year part of a complete date in a custom field?
- Displaying posts with only upcoming dates according their custom field date value
- Use meta_query to display events by date in custom field
- How to exlude posts that have certain meta_value?
- meta_query results not the same with and without spaces
- How to show recent and upcoming birthdays using meta_query
- meta_query all posts between to ages
- How to make a WP REST API query with meta_query in WP4.7?
- WordPress Core – Optimizing meta_query generated SQL?
- Edit post_content on posts with Featured Image
- Meta Query for specific months
- Nested Queries using meta_query
- Display no post when metavalue is 0
- meta_query for a string inside a meta field containing a comma-separated list
- WP User Query fails when searching meta queries and search columns
- Use both meta query and tax query
- Wildcard with LIKE operator in Meta query
- meta_query, number comparison, not quite working as it should
- Meta Query Compare with Date
- Query posts only if meta_value is not empty
- WP_Query meta_query >= date
- Does meta_query working with value paramater higher then 999?
- meta_query keys and sticky posts
- Filter WooCommerce Orders query with user meta data
- WP_Query ordered by meta_value_num doesn’t fetch posts without this meta field
- Query Multiple values for same key
- Custom post type archive with rand and meta_value
- Comparing a field with several values at once with meta_query
- Meta query with a sub query group possible?
- WP_user_query throws a 404 error
- meta_query compare=’!=’ with multiple custom fields
- Fastest way to do meta query when I don’t need the actual posts, and just need post_id?
- meta_query not working on live site
- WordPress, fetching users with an exact match in a string of comma separated values in user_meta
- How to query post only with different excerpt?
- How do you get Posts by multiple meta_keys and meta_values with the Rest API V2?
- Meta_query on same meta key, with diffrenct values
- Query custom field with date
- Meta query with regular expression does not work
- Searching in title or meta, with a tax query too!
- Meta query: How do I return posts within a date period from a given month?
- WP_Query with meta_query no results
- Adding number to date not working [closed]
- Documentation for post meta
- Meta Query posts not showing on ending date of custom field
- WP User Query Issues
- How to use meta query for greater than value in array?
- Wp Query custom search by meta query
- Pre Get Posts / Multiple Meta Keys / Orderby Single Key