Title: Not sorting by views correctly
Last modified: August 22, 2016

---

# Not sorting by views correctly

 *  Resolved [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/)
 * Hi
 * So the plugin is functioning fine, it counts the views correctly, but for some
   reason it sometime sorts my popular post list incorrectly such that posts with
   fewer views are above everything ells. It keeps that way no matter how much I
   visit the other posts, like the sorting function is frozen. It works fine for
   some time when I reset the cache, but after a while it gets frozen again. Is 
   there a solution to this? – I find the solution when changing from total views
   to avg. views, but that is not really what I want to display.
    A side question;
   is it possible for the plugin to not count views for the same visitor multiple
   times?
 * Thanks.
 * [https://wordpress.org/plugins/wordpress-popular-posts/](https://wordpress.org/plugins/wordpress-popular-posts/)

Viewing 15 replies - 1 through 15 (of 28 total)

1 [2](https://wordpress.org/support/topic/not-sorting-by-views-correctly/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/not-sorting-by-views-correctly/page/2/?output_format=md)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856804)
 * Hi there!
 * > So the plugin is functioning fine, it counts the views correctly, but for some
   > reason it sometime sorts my popular post list incorrectly such that posts with
   > fewer views are above everything ells. It keeps that way no matter how much
   > I visit the other posts, like the sorting function is frozen. It works fine
   > for some time when I reset the cache, but after a while it gets frozen again.
 * A screenshot of this would help. Also, are you using a caching plugin (eg. W3TC)?
 * > A side question; is it possible for the plugin to not count views for the same
   > visitor multiple times?
 * Unfortunately, no. The plugin will register every pageview – even from the same
   visitor.
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856826)
 * Can’t provide you with a screenshot atm since I just cleared my cache to make
   the plugin run smooth again. WIll keep this thread alive to keep you informed
   if the bug(?) persist.
 * > Unfortunately, no. The plugin will register every pageview – even from the 
   > same visitor.
 * Is this something you will look to in the future? – Without the great knowledge
   of scripting/writing plugins it seems like your feature “WP popular rating” has
   this kind of option(only members can vote).
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856864)
 * > Can’t provide you with a screenshot atm since I just cleared my cache to make
   > the plugin run smooth again. WIll keep this thread alive to keep you informed
   > if the bug(?) persist.
 * Alright then, please keep me posted.
 * > Is this something you will look to in the future? – Without the great knowledge
   > of scripting/writing plugins it seems like your feature “WP popular rating”
   > has this kind of option(only members can vote).
 * Just to clarify, the rating feature is handled entirely by Lester Chan’s [WP-PostRatings](http://wordpress.org/extend/plugins/wp-postratings/)
   plugin – including user verification. WPP only adds the functionality to the 
   listing.
 * Back on topic, yes I have been looking into it. Excluding views from the same
   visitor is doable – thing is that then it’d also require WPP to track this statistic
   as well: unique visitors vs total visits (_ala_ Google Analytics), because people
   will wonder “hey, why are my statistics going down?”
 * Developing such feature would -probably- also need to reestructure the database
   tables as well. All that can be done, but it requires a lot of testing and of
   course time. I’m pretty sure it’ll end up happening sometime in the future, though.
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856960)
 * Okay so the thing we talked about happened, just now. Views are all over the 
   place.
 * [http://tinypic.com/r/2vw730h/8](http://tinypic.com/r/2vw730h/8)
 * It happened approximately 24 hours after my last reset of the cache.
    I would
   like to say that I am still editing a lot on my site and are installing/deleting
   plugins regularly, maybe there’s a conflict there?
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856961)
 * Did you, by any chance, install a different “popular posts” plugin before installing
   WPP?
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856962)
 * That might very well have been the case. When I began my site-creation I experimented
   with different popular posts plugins, however yours are currently the only active
   PP-plugin. Don’t know if “Special Recent Posts”-plugin might inflict here?
 * When I sort by all time the plugin seems to function fine.
 * [http://tinypic.com?ref=o609sm](http://tinypic.com/r/o609sm/8)
 * Do you want me to delete traces of the other PP-plugins from my database?
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856963)
 * Can you please check your database and see if there’s a table called `wp_PopularPostsdata`?
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856964)
 * Yes I have that.
 * FROM `wp_popularpostsdata`
    LIMIT 0 , 30
 * is this limit supposed to be there?
 * Also have a `wp_popularpostssummary`
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856966)
 * When expecting the wp_popularpostsdata it seems like it keeps track of posts 
   with id’s my current posts don’t have. I looked up the post id’s and it leads
   me to pages. One of the pages are a front-end “create post”-page, so wp_popularpostsdata
   keeps track of my pages as well. Is this intended?
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856977)
 * Yep, WPP also keeps track of pages. That’s intended. They only page WPP doesn’t
   track is the home page for performance reasons.
 * So, there’s just one _wp\_popularpostsdata_ table? Other people with similar 
   issues have reported having two of them: _wp\_PopularPostsdata_ and _wp\_popularpostsdata_,
   and I suspect there’s another plugin out there that’s responsible from creating
   the first one (the latter is from WPP).
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5856982)
 * Strange… yes, there is only one wp_popularpostsdata.
 * I have cleaned my database as good as possible(deleted two old “top 10”-plugin
   tables no longer in use), disable some site-stats plugins, and cleared my WPP
   cache again. Hope this time I won’t run into problems. Will report back to you
   in here if it persists.
 *  [migueleste](https://wordpress.org/support/users/migueleste/)
 * (@migueleste)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5857002)
 * Hi,
 * I’m having the same problem here. In fact I have another one that maybe it’s 
   related.
 * For testing purposes I’m using the deafult widget set to sort posts by “total
   views” and the time range is “last 7 days”
 * I’m also selecting a comma separated list fo categories to include.
 * The two issues I’m having:
    1 – Sort doesn’t seem to be working as described 
   by sponker 2 – Sort seems to be done inside each category. So if my category 
   with the lowest ID has enough posts to fill the 10 positions, none od the other
   categories will show up. Suppose I have category with ID 100, with 10 posts with
   2 views each and category with ID 120 with 5 posts with 5 views each… only the
   10 posts from category 100 will show up.
 * This is kind of weird, because when I check the counts in the backoffice they
   look fine and the counter goes up when i view a specific post. So, just an issue
   sorting output.
 * cheers,
    miguel
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5857012)
 * Since I’m unable to reproduce the sorting issue -everything works fine for me,
   even while using the category filter- I’m gonna need your help, guys.
 * In order to try to replicate the issue locally, please send a fresh backup of
   the following DB tables to hcabrerab at gmail:
    - wp_commentsmeta
    - wp_comments
    - wp_popularpostsdata
    - wp_popularpostssummary
    - wp_postmeta
    - wp_posts
    - wp_terms
    - wp_term_relationships
    - wp_term_taxonomy
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5857021)
 * After deleting some of the tables that could have an impact on the plugin, such
   as “top 10 popular posts”-plugin tables, I haven’t encountered any problems for
   two days now.
 * You want us to send the tables when the bug is current, right?
 *  Thread Starter [sponker](https://wordpress.org/support/users/sponker/)
 * (@sponker)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/#post-5857030)
 * And now I jinxed it.
    I have send you the tables on your mail as requested, I
   figure it’s dot com lastly.
 * Does editing in my theme’s functions.php have anything to do with this? I recently
   did that and the bug kinda appeared after that.

Viewing 15 replies - 1 through 15 (of 28 total)

1 [2](https://wordpress.org/support/topic/not-sorting-by-views-correctly/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/not-sorting-by-views-correctly/page/2/?output_format=md)

The topic ‘Not sorting by views correctly’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

 * 28 replies
 * 3 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/not-sorting-by-views-correctly/page/2/#post-5857176)
 * Status: resolved