I would like to create WP_Query
query and I am using date parameters. How should I should write my query if I want to get all posts from: January 2019 and May 2019 (there is not range).
I would like to create WP_Query
query and I am using date parameters. How should I should write my query if I want to get all posts from: January 2019 and May 2019 (there is not range).
1 Answer
Reset to default 2It's possible to pass multiple sets of arguments to date_query
, so if you set relation
to OR
for them, you should get posts that match either, meaning that you could get the posts you want like this:
'date_query' => [
'relation' => 'OR',
[
'month' => 1,
'year' => 2019,
],
[
'month' => 5,
'year' => 2019,
],
],
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744971673a4604003.html
评论列表(0条)