Title: comment_feed_limits
Published: April 25, 2014
Last modified: April 28, 2025

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#parameters)󠁿

 `$climits`string

The JOIN clause of the query.

`$query`[WP_Query](https://developer.wordpress.org/reference/classes/wp_query/)

The [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/) instance(
passed by reference).

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-query.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-query.php#L2875)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-query.php#L2875-L2875)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Query::get_posts()](https://developer.wordpress.org/reference/classes/wp_query/get_posts/)`wp-includes/class-wp-query.php` |

Retrieves an array of posts based on query variables.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/comment_feed_limits/?output_format=md#comment-content-80)
 2.    [Drew Jaynes](https://profiles.wordpress.org/drewapicture/)  [  12 years ago  ](https://developer.wordpress.org/reference/hooks/comment_feed_limits/#comment-80)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_feed_limits%2F%23comment-80)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_feed_limits%2F%23comment-80)
 4.  Raise the number of comments retrieved in comment feeds from the default (10) 
     to 100:
 5.  In PHP 5.2 or earlier:
 6.      ```php
         /**
          * 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 );
         ```
     
 7.  In PHP 5.3 or later:
 8.      ```php
         // 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"; } );
         ```
     
 9.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_feed_limits%2F%3Freplytocom%3D80%23feedback-editor-80)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fcomment_feed_limits%2F)
before being able to contribute a note or feedback.