Title: [Plugin: WordPress Popular Posts] ERROR: Time range: 30 days, Sort posts by: comments
Last modified: August 20, 2016

---

# [Plugin: WordPress Popular Posts] ERROR: Time range: 30 days, Sort posts by: comments

 *  [Gravuj Miklos Henrich](https://wordpress.org/support/users/henrichro/)
 * (@henrichro)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-error-time-range-30-days-sort-posts-by-comments/)
 * Hi,
 * When I’m selecting the time range to 30 days and the posts to be sorted by comments,
   it shows me the posts by all the time.
 * I think there is a problem in line 513:
 * `$range = $table."cache.day >= '".gmdate("Y-m-d")."' - INTERVAL 30 DAY";`
 * and line 609:
 * `$mostpopular = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_title
   $fields FROM $wpdb->posts $join WHERE $wpdb->posts.post_status = 'publish' AND
   $wpdb->posts.post_password = '' AND $range $force_pv $nopages $exclude GROUP 
   BY $wpdb->posts.ID ORDER BY $sortby DESC LIMIT " . $instance['limit'] . "");`
 * But I don’t know how to solve this.
 * Any ideas?
 * [http://wordpress.org/extend/plugins/wordpress-popular-posts/](http://wordpress.org/extend/plugins/wordpress-popular-posts/)

The topic ‘[Plugin: WordPress Popular Posts] ERROR: Time range: 30 days, Sort posts
by: comments’ 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/)

 * 0 replies
 * 1 participant
 * Last reply from: [Gravuj Miklos Henrich](https://wordpress.org/support/users/henrichro/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/plugin-wordpress-popular-posts-error-time-range-30-days-sort-posts-by-comments/)
 * Status: not resolved