[wp-trac] [WordPress Trac] #41422: Need replace_filter() function for improved Just In Time filter adjusment
WordPress Trac
noreply at wordpress.org
Mon Jul 24 09:42:12 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 | Keywords:
Focuses: |
-------------------------+-----------------------------
In the new solution for text widgets there is some Just In Time code that
adjusts the attached filter functions. The logic finds the priority before
removing the filter function then re-instates the filter with the same
priority.
This logic assumes that the sequence in which the filter functions have
been attached with the same priority are performed doesn't matter.
If this is not the case then the order change could affect processing
where the filter is shared but invoked for different purposes. e.g. the
'widget_text' filter for Text widget and Custom HTML widget
The logic could be improved by implementing a new suite of filter
functions including replace_filter(), restore_filter(), disable_filter()
and a dummy filter function disabled_filter().
Instead of calling remove_filter() and add_filter() we'd use
disable_filter() and restore_filter()
disable_filter() is simply replace_filter() using the disabled_filter()
function.
Example:
Filters attached at priority 10 have been set to do_shortcode and
balanceTags.
With the current logic after JIT replacement the attached filters would
have become
balanceTags then do_shortcode.
Using disable_filter() and restore_filter() the attached filters at
priority 10 would be unchanged.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41422>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list