I am creating a website for a theater company and I am creating an index of all past, current and future productions. I would like the index to "order" the end date of each release (field type "date" ACF; "end_date").
Here is an example of my query:
<?php
$futureProd = array(
'post_type' => 'productions',
'posts_per_page' => -1,
'meta_key' => 'ending_date',
'orderby' => 'meta_value',
'order' => 'ASC',
);
$slider_posts = new WP_Query($futureProd);
$array_rev = array_reverse($slider_posts->posts);
$slider_posts->posts = $array_rev;
?>
We also tried the following, adding alternatives to "meta_value_date" as well as "meta_value_num":
<?php
$futureProd = array(
'post_type' => 'productions',
'posts_per_page' => -1,
'meta_key' => 'ending_date',
'orderby' => 'meta_value_date',
'order' => 'ASC',
);
?>
and
<?php
$futureProd = array(
'post_type' => 'productions',
'posts_per_page' => -1,
'meta_key' => 'ending_date',
'orderby' => 'meta_value_num',
'order' => 'ASC',
);
?>
No matter what I try, the messages refuse to order them using meta_value and instead order themselves by default, post date.
I am sure that I am missing something simple.
Does anyone have any idea?