[wp-trac] [WordPress Trac] #44383: Deprecate the media_buttons_context filter with apply_filters_deprecated()

WordPress Trac noreply at wordpress.org
Tue Jun 19 11:10:34 UTC 2018


#44383: Deprecate the media_buttons_context filter with apply_filters_deprecated()
----------------------------------------+------------------------------
 Reporter:  birgire                     |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Media                       |     Version:  3.5
 Severity:  normal                      |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:
----------------------------------------+------------------------------

Comment (by birgire):

 @zsiderov thanks for the updated patch. Some more notes:

 By translatable I had what @audrasjb wrote in mind.

 The context is filter, not action, so we could test it with:

 {{{
 add_filter( 'media_buttons_context', 'jcorgbuttons' );

 function jcorgbuttons( $context ) {
     return $context .= "<a href='javascript:void(0)'>Hello</a>";
 }

 }}}

 Then visit an ''Edit Post'' page in the backend, to trigger the error.

 The {{{array()}}} will need to be {{{array( '' )}}}, as the input is
 {{{''}}}, not null. Also it's neccessary, to avoid a PHP notice.

 I noticed a bug in core.

 The default {{{$replacement}}} input value for
 {{{apply_filter_deprecated}}} is {{{false}}}, but


 The {{{false}}} value seems not suitable here, unless we extend the
 [https://developer.wordpress.org/reference/functions/_deprecated_hook/
 _deprecated_hook()] function, so it would skip the {{{"Use %3$s
 instead."}}} string part, when it's {{{false}}}.

 Using a {{{null}}} value seems not suitable here too.

 Using {{{'media_buttons'}}} value seems to suggest

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44383#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list