Hello,
I want to order some posts by download number desc, and it seems the articles are random displayed:
$posts = get_posts(array(
‘post_type’ => ‘post’,
‘posts_per_page’ => 12,
‘meta_key’ => ‘post_views_count’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘ASC’
));
But strange, the mysql querry works just fine:
SELECT * FROM wp_postmeta
WHERE meta_key
= ‘post_views_count’ ORDER BY meta_value
DESC
Any help is apperciated, thanks
How is ‘post_views_count’ updated?
is this field a sub field of another field?
Have you echoed out this value for each post to see if they are order by this value?