Opened 6 years ago
Closed 6 years ago
#50059 closed defect (bug) (invalid)
posts_results filter documentation of parameters incorrect.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | 5.4 |
| Component: | Query | Keywords: | |
| Focuses: | docs | Cc: |
Description
Documentation in class-wp-query defines two parameters
- @param WP_Post[] $posts Array of post objects.
- @param WP_Query $this The WP_Query instance (passed by reference).
but code is called with a single parameter being an array of these two:
apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) )
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi there, welcome back to WordPress Trac! Thanks for the report.
It might be confusing, but the documentation is correct as is,
apply_filters_ref_array()passes both of these parameters to the filter separately, not as a single array.This is not specific for
posts_resultsand is the case for any other instance ofapply_filters_ref_array()in core, e.g.comments_pre_query,get_meta_sql, etc.