I have written a plugin that lists the latest published or modified posts, pages or events in a list. However the orderby does not work.
This is my query:
$arg = array (
'post_type' => array( 'post', 'page', 'ai1ec_event'),
'post_status' => 'publish',
'orderby' => 'modified',
'order' => 'DESC',
'posts_per_page' => $noOfPages) ;
$query = new WP_Query($arg);
var_dump($query->request);
The output from var_dump is:
string(229) "SELECT SQL_CALC_FOUND_ROWS hi7ebp_posts.ID
FROM hi7ebp_posts
WHERE 1=1 AND hi7ebp_posts.post_type IN ('post', 'page', 'ai1ec_event')
AND ((hi7ebp_posts.post_status = 'publish'))
ORDER BY hi7ebp_posts.menu_order ASC
LIMIT 0, 5"
My 'orderby' => 'modified', 'order' => 'DESC' is not part of the sqlquery!
Why?
/Erik