group by query for custom field?
-
Hi all,
I am having custom field ‘city’ for multiple posts,
and I need to display distinct city names with posts count,
e.g:London (13)
Paris (10)
where 13 and 10 are number of posts means there are 13 posts having custom field ‘city’ value as ‘London’.
what will be the query?$query = new WP_Query(array('post_type'=>'post','cat'=>'17','meta_key'=>'City','groupby'=>'meta_value'));
did not worked.
any help?
how to use posts_groupby?
- The topic ‘group by query for custom field?’ is closed to new replies.