Filters the LIMIT clause of the query.
Parameters
Source
$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
| CARVIEW |
Filters the LIMIT clause of the query.
LIMIT clause of the query before the query is sent to the database, allowing you to define a new query LIMIT.null to remove the LIMIT clause from the query, allowing you to return all results. However, this will set $wp_query->found_posts to 0.LIMIT will 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.$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
| Used by | Description |
|---|---|
WP_Query::get_posts()wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
Example migrated from Codex:
The example below allows your query to return 25 results only for the search page. All other queries will continue to return the default value.