[wp-trac] [WordPress Trac] #41422: Need replace_filter() function for improved Just In Time filter adjusment

WordPress Trac noreply at wordpress.org
Thu Aug 3 15:59:08 UTC 2017


#41422: Need replace_filter() function for improved Just In Time filter adjusment
-------------------------+------------------------------
 Reporter:  bobbingwide  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Formatting   |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by bobbingwide):

 The solution for #40951 includes just in time code to `remove_filter(
 'widget_text', 'do_shortcode', $widget_text_do_shortcode_priority )` and
 then re-add it with the same priority that it had.

 If there are other filters at that priority then the sequence in which the
 filters are applied is unintentionally changed. See src/wp-
 includes/widgets/class-wp-widget-text.php

 This new core logic is trying to make adjustments to filters that have
 been added / changed by plugins or the theme. It should not break
 something that has been carefully crafted by the plugins or theme.

 Use of replace_filter() is easier than other solutions that would be
 required to maintain the sequence within priority.

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


More information about the wp-trac mailing list