ghacks Technology News

WordPress Hack: Change Number Of Comments Per Page In Admin Interface

WordPress is displaying 20 comments per page in the admin interface. This might not be a problem for users who usually get a handful of comments per day but it forces webmasters with hundreds of comments per day to flip through the pages quite often. The 20 comments per page figure is actually the figure for both the approved comments and the comments identified as spam.

Another thing that is really annoying in WordPress 2.7 is the fact that you can either delete all comments on the page, selected comments or all spam comments at once. At 20 spam comments per page and thousands in total this can take a long time to flip through and delete.

The WordPress hack is actually quite easy to perform even for webmasters who have no knowledge whatsoever regarding html and php. The file that is responsible for the amount of comments that are displayed is called edit-comments.php. It can be found in the wp-admin folder. Make sure you backup that file before you apply the changes so that you can revert back if something should go wrong.

Locate the following line in the file, it should be around line 182 in the file:

$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);

The only thing that you need to do is to change the figure 20 to another figure, e.g. 100 so that it looks like this:

$comments_per_page = apply_filters('comments_per_page', 100, $comment_status);

Just save the file again and check the display of the comments in the admin interface to make sure everything is working correctly.

Enjoyed the article?: Then sign-up for our free newsletter or RSS feed to kick off your day with the latest technology news and tips, or share the article with your friends and contacts on Facebook or Twitter.

Related Articles:

How To Change The WordPress Admin Interface Fonts
WordPress Comments Notifier
Speed Up WordPress Page Loading Times By Removing l10n.js
WordPress Remote Admin Password Reset Vulnerability
Free Anti Spam Plugin Antispam Bee For WordPress



About the Author:Martin Brinkmann is a journalist from Germany who founded Ghacks Technology News Back in 2005. He is passionate about all things tech and knows the Internet and computers like the back of his hand. You can follow Martin on Facebook or Twitter.

Author: , Wednesday December 17, 2008 -
Tags:, , , , , , ,


Responses so far:

  1. RG says:

    Thanx Martin. Like you said this one is easy but a heavily hacked WordPress install has at least the potential of lots more work every time there is an update. I keep having to write down what I have done, at least most of the things I have done so far are in specific theme folders so they are sometimes unaffected with security or minor upgrades.

  2. Adrian Kuhn says:

    You saved my day, thanks!

  3. ultraspy says:

    I heart you! THANKS! You save me HOURS of work!

  4. Infographiste says:

    Page Bookmarked, thnaks for sharing!

  5. Friend, this was very helpful even for a novice like me. Thanks.

  6. Please don’t make edits to the core of WordPress. This is exactly what the filter is there for. A filter let’s you modify the value before it is used, and make that modification from your theme so the change isn’t lost when you upgrade.

    Put this in your functions.php file in your theme:

    add_filter( ‘comments_per_page’, ‘custom_comments_per_page’ );
    function custom_comments_per_page() {
    return ’100′;
    }

    Change 100 to whatever number you want.

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

Subscribe without commenting

© 2005-2012 Ghacks.net. All Rights Reserved. Privacy Policy - About Us