meta_query select and order two meta_keys
-
I’m trying to select events and order them.
This is how I’m doing it:
$args = array(
‘showposts’ => -1,
‘cat’ => $settings[“js_evcat”],
‘meta_query’ => array(
‘relation’ => ‘OR’,
array(
‘key’ => ‘evdata’,
‘value’ => $ieri,
‘compare’ => ‘>=’,
‘type’ => ‘numeric’,
),
array(
‘key’ => ‘evdata_end’,
‘value’ => $ieri,
‘compare’ => ‘>=’,
‘type’ => ‘numeric’,
)
),
‘orderby’ => array(
array(
‘meta_key’ => ‘evdate’,
‘order’ => ‘ASC’
),
array(
‘meta_key’ => ‘evdate_end’,
‘order’ => ‘ASC’
)
)
);$postslist = get_posts( $args );
where:
evdata is the date event starts,
evdata_end is the date event end (both unix timestamps)
$ieri – unix timestamp of todayorberby – from https://core.trac.www.ads-software.com/ticket/17065#comment:14
I’m getting an error:
Warning: urldecode() expects parameter 1 to be string, array given in /home/bigcity/public_html/wp-includes/query.php on line 2370
If I try to order with
‘meta_key’ => ‘evdata’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘ASC’I’m getting results outside meta_query.
- The topic ‘meta_query select and order two meta_keys’ is closed to new replies.