Reputation: 1133
I have done a lot of research, followed suggestions and ended up with the following query:
$query = array(
'posts_per_page' => (int) $count,
'post_type' => 'post',
'meta_key' => '_kjl_fb_likes',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
But post are just not ordered by the number of likes.
Meta date is checked and it is saved with every post.
Any help or guidance is much appreciated.
Upvotes: 0
Views: 53
Reputation: 2124
I think you need to cast meta type as unsigned integer, try this:
$query = array(
'posts_per_page' => (int) $count,
'post_type' => 'post',
'meta_key' => '_kjl_fb_likes',
'meta_type' => 'UNSIGNED',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
Upvotes: 1