[wp-trac] [WordPress Trac] #14671: Deprecate the "accepted args" argument in add_filter() and add_action()

WordPress Trac noreply at wordpress.org
Thu May 30 18:33:29 UTC 2013


#14671: Deprecate the "accepted args" argument in add_filter() and add_action()
-------------------------+-----------------------------
 Reporter:  markjaquith  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Plugins      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------------

Comment (by westonruter):

 Replying to [comment:36 alex-ye]:
 > mmm, If I am not miss anything but is this will broke such examples?!
 >
 >
 > {{{
 > // esc_url only need the first arg.
 > add_filter( 'post_link', 'esc_url' );
 >
 > apply_filters( 'post_link', $url, $post_id );
 >
 > function esc_url( $url, $protocols, $_context ){
 > // function code.
 > }
 > }}}

 No, it will not break. See the code in the patch checks to see how many
 arguments that the `esc_url` function accepts via the Reflection API, and
 it will pass in as many arguments from the `apply_filters` call as the
 supplied filter function accepts.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/14671#comment:37>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list