[wp-trac] [WordPress Trac] #33862: Improve docblock for add_filter

WordPress Trac noreply at wordpress.org
Mon Sep 14 12:58:14 UTC 2015


#33862: Improve docblock for add_filter
--------------------------+-----------------------------
 Reporter:  bobbingwide   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  docs          |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33862>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list