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.

Parameters

$comments_per_pageint
The number of comments to list per page.
$comment_statusstring
The comment status name. Default 'All'.

Source

return apply_filters( 'comments_per_page', $comments_per_page, $comment_status );

Changelog

VersionDescription
2.6.0Introduced.

User Contributed Notes

  1. Skip to note 2 content
    /**
     * 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.