Advanced ordering of query_posts

I don’t think this is doable in a single WP API query. You just don’t sort whole set with single logic, you have logic changing halfway. I don’t think even SQL can express this. It is hard to advise without seeing specific circumstances (such as counts, pagination involved and so on), but my first thought … Read more

Get user categories with most posts in it

Your question is slightly ambiguous, but I read it this way: given an author and you want to know the three categories in which has published most posts. Let’s use wp_query to get there. $author=”johndoe”; $author_posts = new WP_Query (array ( ‘author’ => $author, ‘posts_per_page’=>-1, )); Now we have an array of all posts by … Read more