Support » Plugins and Hacks » Hacks » WP_Query – multiple custom post types and sort by custom meta
3 years, 7 months ago
I’d like get results from two custom post types and sort them by custom meta (date of start events).
$warsztaty_q = new WP_Query(array(
'post_type' => array('kalendarium', 'warsztaty'),
'order_by' => 'meta_value',
'meta_key' => 'data_start',
'order' => 'ASC'
Would be ok but first sorted is ‘kalendarium’ and then ‘warsztaty’ so in query results first sorted are posts from ‘kalendarium’ and next from ‘warsztaty’ not together.
I found this solution:
But I can’t get custom meta 🙁
Anyone can help me? 🙂
Problem resolved. Should be ‘orderby’ instead of ‘order_by’