Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to do a query and sort posts by views. Is this possible? I'm not even sure where to start..

share|improve this question
1  
take a look at gist.github.com/2175805 –  Bainternet Apr 11 '12 at 6:52
    
@Bainternet In a high traffic scenario there will be a race condition with this approach. –  Brian Fegter Aug 31 '12 at 13:23
    
@BrianFegter not really but it will lose count if a simple cache plugin is in place. –  Bainternet Aug 31 '12 at 16:20
    
@Bainternet A race condition will occur if more than one connections are trying to increment that postmeta at the same time. I've built one of these before for a site with millions of hits a day and it's a reality. To route the caching, we did it asynchronously combined with memcache. We then converted memcache over to postmeta at intervals. If it's a low traffic scenario, there shouldn't be an issue. –  Brian Fegter Aug 31 '12 at 17:05
    
@BrianFegter That makes sense :) –  Bainternet Sep 1 '12 at 10:02

1 Answer 1

up vote 4 down vote accepted

WordPress does not maintain post view count by default.

But you may find the following post helpful.

Does wordpress have a post hit counter?

You may also have a look on the WP-PostViews plugin.

Many thanks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.