First, can use
meta_query, but, you should change your values to use the proper date format, e.g. 2020/01/02 for January 2nd, rather than a regional format. See https://en.wikipedia.org/wiki/ISO_8601 for more details.
LIKE query is going to be very expensive, and achieving what you want while still using a
LIKE query will be even more expensive. So, store a second user meta that contains the month and day, but always sets the year to the same value
Then, do something similar to this:
'meta_query' => [
'meta_key' => 'birthday_no_year',
'compare' => 'BETWEEN',
'meta_value' => [ '2000/01/01', '2000/02/01' ],
'type' => 'DATE'
- You'll need to write code to store
birthday_no_year values too
- You'll need to add these values for existing users
- Searching for objects that have a particular meta value is very expensive, whether it's searching/filter posts by their post meta, or filtering users by their user meta. It doesn't scale, and it can get so expensive that it brings down servers. Cache this and look for alternative ways to store the data.
And finally, users should opt-in, this functionality may be considered a leak of personally identifiable information, revealing a users date of birth. This runs foul of numerous data protection and privacy laws, particularly in Europe. I recommend consulting with a lawyer, especially if you're intending to expose the age of the person.