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

WordPress Trac noreply at wordpress.org
Tue Jul 25 12:00:25 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):

 Replying to [comment:3 azaozz]:

 > As far as I see disabling and then enabling a hook is pretty similar to
 removing and then re-adding a hook. The only (meaningful) difference is
 that it keeps the "order of loading" sub-priority

 Exactly. It maintains the status quo. And just in time hook replacement
 should aim to do this. WordPress core allows plugins and themes to change
 the sequence of hooks. It should respect those changes.

 > which shouldn't matter in the first place if priorities are used
 properly. If they are not, lets fix them.

 Ah, there's the rub. If you change core then people will complain.
 So you have to work with the existing flawed implementation and patch it
 up a bit.
 WordPress core has many cases where multiple filter functions are used at
 the same priority.

 > So this adds a second "priority" thing which is starting to get
 confusing: remove_action, disable_action, remove_disabled_action,
 enable_removed_action, ... etc.

 I didn't want to propose too many bells and whistles.
 - No need to develop aliases of the filter functions for hooks
 - No need to be able to stack replacements using push/pop logic
 - Priority must be specified

 I haven't actually raised a bug report against the do_shortcode,
 balanceTags problem since
 - It's not actually a problem for me
 - I can develop a workaround for my own plugin
 - My workaround is backward compatible; it should not require changes to
 any other plugins

 But I can envisage other plugins and themes where the current JIT logic
 can cause a problem and will need a fix. Hence this TRAC.

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


More information about the wp-trac mailing list