Folks, 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.
- Open the /wp-admin/edit-comments.php document in your favorite text editor.
- 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
)); - Change all 4 of the instances of the number “20” above to “50” – or however many you want to display per page.
- Change the 1 instance of the number “25” above to “55” – or 5 more than the number you display per page.
- 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.
Thanks a lot for your code John!
I really like and appreciate your blog.Really thank you! Fantastic.
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
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
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
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
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 :)
Sir John,
thank you for that, just did it, now I just need that much comments… hehe
cheers
Rhoody