WP_REST_Posts_Controller::get_collection_params(): array
- Since
- 4.7.0, 5.4.0, 5.7.0
- Source
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php:2882
Compatibility
- WordPress
- since 5.7.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Return value
array- Collection parameters.
Performance profile
How much work a call to WP_REST_Posts_Controller::get_collection_params() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 189–262
- Plugin surface
- 1 hook
- Called by
- 6
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 262.
Third-party callbacks on 'rest_{$this->post_type}_collection_params' run inside this call, and their cost is not bounded by anything here.
6 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()called directly
Further down the call graph this can also reach query, option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 96 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_REST_Posts_Controller::get_collection_params() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!post_type_supports() && !$post_type | 189 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() && !$post_type | 189 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() && !$post_type | 192–196 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() && !$post_type | 192–196 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() && !$post_type | 196 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!post_type_supports() && !$post_type | 196 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 196 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() && !$post_type | 199–203 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!post_type_supports() && !$post_type | 199–203 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 199–203 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 203 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!post_type_supports() | 204–207 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
84 further outcomes, up to 262 instructions
!post_type_supports() | 204–207 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 205 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 205 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 206–210 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 207 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 207 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() | 207–214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() | 207–214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 208–212 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 208–212 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 210–214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 210–214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() | 211–214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!post_type_supports() | 211–214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 211–214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 212 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 212 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 212 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 214 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!post_type_supports() | 214–221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!post_type_supports() | 214–221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 214–221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 215–219 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 215–219 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 215–219 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 217–221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 217–221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 217–221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
| always | 218–221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
!$post_type | 219 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 220–223 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 220–223 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 221 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 221–228 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 222–225 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
| always | 222–225 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
!$post_type | 222–226 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() && !$post_type | 223 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 223 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 223–230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 223–230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 224–228 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 225–232 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
| always | 225–232 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
post_type_supports() && !$post_type | 226–230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 226–230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 227–230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 227–230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 227–230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 229–232 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 229–232 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 229–232 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
post_type_supports() && !$post_type | 230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() && !$post_type | 230 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 230–237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 230–237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 230–237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 232–239 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 232–239 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
| always | 232–239 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), apply_filters() |
post_type_supports() && !$post_type | 233–237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
!$post_type | 233–237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() && !$post_type | 233–237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 234–237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 236–239 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
post_type_supports() && !$post_type | 237 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 237–244 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 238–241 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 238–241 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 239–246 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), apply_filters() |
post_type_supports() && !$post_type | 240–244 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 241–248 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 241–248 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 245–248 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 245–248 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 245–248 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 248–255 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
| always | 248–255 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 248–255 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 252–255 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
post_type_supports() | 255–262 | ::get_collection_params(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), __(), post_type_supports(), __(), __(), __(), __(), __(), post_type_supports(), get_post_type_object(), __(), __(), __(), __(), __(), get_post_stati(), array_keys(), array_merge(), ->prepare_taxonomy_limit_schema(), __(), post_type_supports(), __(), get_post_format_slugs(), array_values(), apply_filters() |
Across PHP versions
Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 262 instructions, 189–262 executed per call, 9 branches. The work does not change between versions.
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 1
One hook fires while WP_REST_Posts_Controller::get_collection_params() runs, in this order:
- apply_filters( rest_{$this->post_type}_collection_params )filterline 3081 (+199 into the body)
Filters collection parameters for the posts controller.
Uses · 8
- __()Retrieves the translation of $text.
- post_type_supports()Checks a post type's support for a given feature.
- get_post_type_object()Retrieves a post type object by name.
- get_post_stati()Gets a list of post statuses.
- get_post_format_slugs()Retrieves the array of post format slugs.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- WP_REST_Controller::get_collection_params()Retrieves the query params for the collections.
- WP_REST_Posts_Controller::prepare_taxonomy_limit_schema()Prepares the collection schema for including and excluding items by terms.
Used by · 6
- WP_REST_Attachments_Controller::get_collection_params()Retrieves the query params for collections of attachments.
- WP_REST_Font_Faces_Controller::get_collection_params()Retrieves the query params for the font face collection.
- WP_REST_Font_Families_Controller::get_collection_params()Retrieves the query params for the font family collection.
- WP_REST_Menu_Items_Controller::get_collection_params()Retrieves the query params for the nav menu items collection.
- WP_REST_Posts_Controller::get_items()Retrieves a collection of posts.
- WP_REST_Posts_Controller::register_routes()Registers the routes for posts.
Source code
public function get_collection_params() { $query_params = parent::get_collection_params(); $query_params['context']['default'] = 'view'; $query_params['after'] = array( 'description' => __( 'Limit response to posts published after a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); $query_params['modified_after'] = array( 'description' => __( 'Limit response to posts modified after a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); if ( post_type_supports( $this->post_type, 'author' ) ) { $query_params['author'] = array( 'description' => __( 'Limit result set to posts assigned to specific authors.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), ); $query_params['author_exclude'] = array( 'description' => __( 'Ensure result set excludes posts assigned to specific authors.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), ); } $query_params['before'] = array( 'description' => __( 'Limit response to posts published before a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); $query_params['modified_before'] = array( 'description' => __( 'Limit response to posts modified before a given ISO8601 compliant date.' ), 'type' => 'string', 'format' => 'date-time', ); $query_params['exclude'] = array( 'description' => __( 'Ensure result set excludes specific IDs.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), ); $query_params['include'] = array( 'description' => __( 'Limit result set to specific IDs.' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), 'default' => array(), ); if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) { $query_params['menu_order'] = array( 'description' => __( 'Limit result set to posts with a specific menu_order value.' ), 'type' => 'integer', ); } $query_params['search_semantics'] = array( 'description' => __( 'How to interpret the search input.' ), 'type' => 'string', 'enum' => array( 'exact' ), ); $query_params['offset'] = array(Changelog
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
modified_after and modified_before query parameters were added.from the docblocktax_relation query parameter was added.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.