apply_filters( 'comments_per_page', int $comments_per_page, string $comment_status )

Filters the number of comments listed per page in the comments list table.


Description Description


Parameters Parameters

$comments_per_page

(int) The number of comments to list per page.

$comment_status

(string) The comment status name. Default 'All'.


Top ↑

Source Source

File: wp-admin/includes/class-wp-comments-list-table.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Drew Jaynes
    /**
     * Increase comments-per-page limit when viewing spam comments.
     *
     * @see WP_Comments_List_Table::get_per_page()
     *
     * @param int    $comments_per_page The number of comments to list per page.
     * @param string $comment_status    The current comment status view. Default is 'all'.
     * @return int The filtered number of comments to list per page.
     */
    function wpdocs_spam_comments_per_page( $comments_per_page, $comment_status ) {
    	if ( 'spam' == $comment_status ) {
    		$comments_per_page = 50;
    	}
    	return $comments_per_page;
    }
    add_filter( 'comments_per_page', 'wpdocs_spam_comments_per_page', 10, 2 );
    

You must log in before being able to contribute a note or feedback.