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.

Tags: ,

Related Posts