Custom Post Types UI WP_QUERY
-
Hello i have custom post types ui plugin installed. i have custom post type hotels and one of my custom taxonomy is named stars.
i want to sort hotels by stars in the loop, but it doesn’t work.
my code:
$second_query = new WP_Query( array (
'post_type' => 'hotels',
'post_status' => 'publish',
'posts_per_page' => '16',
'orderby' => 'stars',
'order' => 'ASC',
'paged' => $paged
)
);
while( $second_query->have_posts() ) : $second_query->the_post();
(...)
it shows hotels but doesn’t order by stars.
when i usedvar_dump($wp_query->request);
it shows:
string(137) " SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND (wp_posts.ID = '2') AND wp_posts.post_type = 'page' ORDER BY wp_posts.post_date DESC "
custom post types are editable in admin panel.
Thanks in advance!
The topic ‘Custom Post Types UI WP_QUERY’ is closed to new replies.