apply_filters_ref_array( 'comment_feed_limits', string $climits, WP_Query $query )

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


Parameters Parameters

$climits

(string) The JOIN clause of the query.

$query

(WP_Query) The WP_Query instance (passed by reference).


Top ↑

Source Source

File: wp-includes/class-wp-query.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Drew Jaynes

    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.