Answer the question
In order to leave comments, you need to log in
How to make a query sorted by year of birth WP_Query?
Good day!
There is an arbitrary field "Date", where the date of birth of a person is selected.
It is necessary to make sure that posts are displayed on the archive page in ascending order of the year of birth, i.e. older ones at the beginning and younger ones at the end.
This example sorts by an arbitrary field of pure numeric value. And the date is displayed like this 06/21/2001, so it's not possible to sort in the same way
$query = new WP_Query( array(
'post_type' => 'property',
'meta_query' => array(
array(
'key' => 'price',
'value' => 50000,
'compare' => '<=',
'type' => 'NUMERIC',
),
),
) );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question