On this page
apply_filters_ref_array( 'post_limits', string $limits, WP_Query $query )
Filters the LIMIT clause of the query.
Parameters
More Information
- This filter applies to the
LIMITclause of the query before the query is sent to the database, allowing you to define a new queryLIMIT. - You can return
nullto remove theLIMITclause from the query, allowing you to return all results. However, this will set$wp_query->found_poststo0. - On some server environments, the
LIMITwill be applied to all queries on the page. This results in menu items and widgets also being limited to the defined number. To only limit the number of posts on a page use the action hook pre_get_posts.
Source
File: wp-includes/class-wp-query.php. View all references
$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
Related
Used By
| Used By | Description |
|---|---|
| WP_Query::get_posts() wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/post_limits