wppaste
WordPress

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:2974
Retrieves the query params for the posts collection.

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

Touches nothing outside its own arguments.

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
189–270

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 270.

Plugin surface
1 hook

Third-party callbacks on 'rest_{$this->post_type}_collection_params' run inside this call, and their cost is not bounded by anything here.

Called by
6

6 places in core call this, so the cost is paid more often than your own code shows.

What it touches

  • hookthird-party callbacksapply_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.

WhenInstructionsCalls it makes
!post_type_supports() && !$post_type189::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_type189::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_type192–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_type192–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_type196::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_type199–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_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()
!post_type_supports() && !$post_type204::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()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_supports() && !$post_type204::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_type205::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_type205::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()
84 further outcomes, up to 270 instructions
!$post_type207::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_type207::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() && !$post_type207–211::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_supports() && !$post_type207–211::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_type208–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_type208–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_type210–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_type210–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()
always211–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_type211::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_type212::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_type214::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()
always214–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_type214–218::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_type215–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_type217–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_supports()219–222::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()219–222::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()
always220–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_type220::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()
always220–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_type220::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()
always222–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()
!$post_type222::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()
always222–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_type222::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()222–229::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()222–229::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_type223::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_type223::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()
always223–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_type223–227::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()
always223–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_type223–227::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()
always225–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_type225–229::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()
always225–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_type225–229::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()
always226–229::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_type226–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_type226–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()
always227–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_type227::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()
always229–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_type229::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()
always229–236::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_type230::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()
always230–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_type230–234::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()
always232–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_type232–236::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_type233–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()
always235–238::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()
always235–238::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()
always237–240::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()
always237–240::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()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()
post_type_supports() && !$post_type238::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()
always238–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()
!$post_type238::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()
always238–245::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()
always238–245::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()
always240–247::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()
always240–247::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()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()
post_type_supports() && !$post_type241–245::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()
always241–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_type241–245::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()
always242–245::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()
always244–247::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()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() && !$post_type245::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()
always245–252::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()
always247–254::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()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() && !$post_type248–252::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()253–256::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()
always253–256::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()256–263::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()
always256–263::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()260–263::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()263–270::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: 270 instructions, 189–270 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:

  1. apply_filters( rest_{$this->post_type}_collection_params )filterline 3179 (+205 into the body)

    Filters collection parameters for the posts controller.

Uses · 8

Used by · 6

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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.7.0
The modified_after and modified_before query parameters were added.from the docblock
5.4.0
The tax_relation query parameter was added.from the docblock
4.7.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 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.