Opened 6 years ago
Closed 6 years ago
#49219 closed defect (bug) (invalid)
feed.php calls apply_filters with too many arguments
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.3.2 |
| Component: | Feeds | Keywords: | |
| Focuses: | Cc: |
Description
feed.php calls apply filters like this:
return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show );
But in class-wp-hook, apply_filters only accepts 2 parameters. So when filters are called for get_bloginfo_rss, they get the text, but not what was requested making it very hard to acutally create a meaningful filter.
It needs to be changed to
return apply_filters( 'get_bloginfo_rss', array(convert_chars( $info ), $show) );
so that both items are passed to the filter.
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi there, welcome to WordPress Trac! Thanks for the ticket.
There are 1200+ instances of passing more than two arguments to
apply_filters()in WordPress core.While the
WP_Hook::apply_filters()method indeed only accepts two parameters, the apply_filters() function accepts any number of parameters to pass to the callback function usingfunc_get_args().If you want your callback function to receive these additional parameters, you have to specify the number of arguments as the 4th parameter in your
add_filter()call:There is no bug here, this code works as intended.
Related: #33891