apply_filters_ref_array( ‘comment_feed_limits’, string $climits, WP_Query $query )

Filters the LIMIT clause of the comments feed query before sending.


The JOIN clause of the query.
The WP_Query instance (passed by reference).


$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option( 'posts_per_rss' ), &$this ) );



User Contributed Notes

  1. Skip to note 2 content

    Raise the number of comments retrieved in comment feeds from the default (10) to 100:

    In PHP 5.2 or earlier:

     * Filter the LIMIT clause on comment feed queries.
     * @param string   $limit    LIMIT clause for the comment feed query.
     * @param WP_Query $instance WP_Query instance, passed by reference.
     * @return string (maybe) Filtered comment feed query LIMIT clause.
    function wpdocs_raise_comment_feed_limit( $limit, &$instance ) {
    	return 'LIMIT 100';
    add_filter( 'comment_feed_limits', 'wpdocs_raise_comment_feed_limits', 10, 2 );

    In PHP 5.3 or later:

    // Filter the LIMIT clause on comment feed queries to increase the number from 10 to 100.
    add_filter( 'comment_feed_limits', function( $a ) { return "LIMIT 100"; } );

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