Opened 11 years ago
Closed 11 years ago
#33862 closed defect (bug) (fixed)
Improve docblock for add_filter
| Reported by: | bobbingwide | Owned by: | DrewAPicture |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Plugins | Version: | 4.4 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: | docs |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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).