• Home
  • About John P.
  • Contact
  • Terms
  • Facebook
  • LinkedIn
  • Pinterest
  • Twitter
  • YouTube

One Man's Blog

Specialization is for Insects.

  • 10 Best
  • Art
  • Computing
  • Fun Stuff
  • Gadgets
  • Videos
  • Photography
  • Travel
  • Tutorials
  • Health & Fitness
  • Politics
  • Thoughts
  • Food
  • Reviews
  • 10 Best
  • Art
  • Computing
  • Fun Stuff
  • Gadgets
  • Videos
  • Photography
  • Travel
  • Tutorials
  • Health & Fitness
  • Politics
  • Thoughts
  • Food
  • Reviews
Home / Wordpress / Tutorial: Howto Increase the Number of Comments Visible in WordPress Editor

Tutorial: Howto Increase the Number of Comments Visible in WordPress Editor

John P.

March 4, 2008 By John P.

WordPress CommentsFolks, I get a lot of comments here on One Man’s Blog (nearly 7,000 at this point). Often there are well over 20 between times I check, even within one day, but the standard page view in the Edit Comments administration page only shows 20 thereby causing me to scroll from page to page in order to view / moderate more comments.

So, I just hacked mine to show 50 per page instead. Here is how you go about it.

  1. Open the /wp-admin/edit-comments.php document in your favorite text editor.
  2. Do a search for the number “20”. Eventually you will come across the following code:

    $start = $offset = ( $page – 1 ) * 20;

    list($_comments, $total) = _wp_get_comment_list( isset($_GET[‘s’]) ? $_GET[‘s’] : false, $start, 25 ); // Grab a few extra

    $comments = array_slice($_comments, 0, 20);
    $extra_comments = array_slice($_comments, 20);

    $page_links = paginate_links( array(
    ‘base’ => add_query_arg( ‘apage’, ‘%#%’ ),
    ‘format’ => ”,
    ‘total’ => ceil($total / 20),
    ‘current’ => $page
    ));

  3. Change all 4 of the instances of the number “20” above to “50” – or however many you want to display per page.
  4. Change the 1 instance of the number “25” above to “55” – or 5 more than the number you display per page.
  5. After you modify it, the section should look like:

    $start = $offset = ( $page – 1 ) * 50;

    list($_comments, $total) = _wp_get_comment_list( isset($_GET[‘s’]) ? $_GET[‘s’] : false, $start, 55 ); // Grab a few extra

    $comments = array_slice($_comments, 0, 50);
    $extra_comments = array_slice($_comments, 50);

    $page_links = paginate_links( array(
    ‘base’ => add_query_arg( ‘apage’, ‘%#%’ ),
    ‘format’ => ”,
    ‘total’ => ceil($total / 50),
    ‘current’ => $page
    ));

The good news is, this works perfectly. The bad news is, you’re going to have to redo this every time you update WordPress until we finally get a selection menu baked into the core.

Related

Filed Under: Wordpress Tagged With: Hacks, Wordpress

About John P.

John P. is a former CEO, former TV Show Host, and the Founder and Wizard behind Texas Metal Works. You can find him on Twitter, Facebook and LinkedIn. Feel free to send shoutouts, insults, and praise. Or Money. Money is good.

Comments

  1. Andrea says

    March 31, 2014 at 9:31 am

    Thanks a lot for your code John!

  2. Hong says

    April 12, 2012 at 11:32 am

    I really like and appreciate your blog.Really thank you! Fantastic.

  3. Mike Clark says

    February 25, 2010 at 6:49 am

    Great instructions, here is the update:

    edit the same file, look for $comments_per_page

    change the value to your number of choice.

    Cheers
    Mike

  4. John P. says

    March 12, 2008 at 8:14 am

    Debi,

    This modification only affects the number of comments that show up on the back end of the blog in the administration page. Your theme and plugins will affect the number that show up on the actual blog for readers. By default ALL comments will show up on the same page, so I use the threaded comments plugin to show only about 25 at a time to my readers.

    You can see my entire list of plugins here.

    John

  5. Debi says

    March 11, 2008 at 10:29 pm

    This may seem like an odd question….I’m fairly new to blogging. Why would you want to have more than 20 comments showing? Won’t lots of comments on each article eventually make your blog tough to scroll through? And if you want more than 20, is 50 the max you consider putting in there?

    I like the idea of shortening the number of chars that show up. It would assist with some of the scrolling issues, along with giving your readers the opportunity to select from more comments, and then select the ones that they want to get complete details on.

    Thanks for the great info you provide!
    Debi J

  6. 3gp says

    March 11, 2008 at 5:31 am

    Thanks alot john i love your tutorials they are amazing simple understand able just few lines of code and it is done. Wow you rock Sir

  7. Mistergin says

    March 4, 2008 at 10:31 am

    Good idea John. Haven’t had any big hitting stories recently, but a few months ago I had one on animal abuse that is still popular (almost 600 comments or so?) and while they trickle in now, when it was posted, I was doing the same..

    While I’m in that code, I’d also recommend modifying Akismnet (however it’s spelled lol), to trim the comment to only the first 300 characters or so. When checking for false positives it’s tedious because some of the comment spam that gets caught is hundreds of links in a single post.

    Bookmarked :)

  8. Rhoody says

    March 4, 2008 at 2:35 am

    Sir John,
    thank you for that, just did it, now I just need that much comments… hehe

    cheers

    Rhoody

John P’s Tweets

Tweets by johnpoz

Read Over 2,500,000 Times

  • How I'd Hack Your Weak Passwords
  • Amusing Little Helicopter Game
  • A Compendium of 150 Monty Python Sketches
  • 10 Worst Drivers Ever Caught On Video
  • Get Your Virtual Haircut and Other Auditory Illusions
  • How Crack Cocaine is Made

Copyright © 2022 · Local Media on Genesis Framework · WordPress · Log in