Opened 11 years ago
Closed 11 years ago
#33862 closed defect (bug) (fixed)
Improve docblock for add_filter
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.4 | Priority: | normal |
| Severity: | normal | Version: | 4.4 |
| Component: | Plugins | Keywords: | |
| Focuses: | docs | Cc: |
Description
These two sentences in the documentation for apply_filters() is badly worded and/or incorrect.
Since WordPress 1.5.1, bound callbacks can take as many arguments as are passed as parameters in the corresponding apply_filters() call. The $accepted_args parameter allows for calling functions only when the number of args match.
I believe that what it's trying to say is that apply_filters will limit the number of parameters that it passes to a callback to the value specified in $accepted_args.
Therefore I believe there should be a warning in the documentation saying that, if the $accepted_args parameter is lower than the number actually being passed then things might not work properly.
Either that or we just remove the sentence.
Change History (2)
Note: See
TracTickets for help on using
tickets.
I agree that read in the wrong context, the second sentence is misleading. Realistically, supplying the incorrect value for
$accepted_argsalready throws an error describing the problem (the number of arguments being wrong).