On my Wordpress-website, I have a custom post type used to display events and a page showing all events in the database. On that page, I'm creating a new WP_Query and displaying the results immediately afterwards.
$q_events = new WP_Query(array('post_type' => 'lc_events', 'orderby' => 'ID')); if ($q_events->have_posts()) : while ( $q_events->have_posts() ) : $q_events->the_post(); ?> <div class="activiteit"> <?php ...
orderby-option doesn't work, no matter what option I'm actually ordering by. In the code above you see
ID, but I have also tried
title and meta values (using
'meta_key' => 'lc_events_startdate', 'orderby' => 'meta_value', 'order' => 'ASC'. I have yet to figure out in what order events are actually displayed, but have ruled out ID, title, two of my meta values (
lc_events_enddate) and post date/time.
I know that
orderby was changed in WP4.0, but cannot determine whether my problem is caused by a bug, or by an error in my coding.
EDIT (October 3): WP_DEBUG is set to true, and only shows a notice concerning a script in my sidebar, nothing regarding the WP_Query.
Thanks for all help,