[wp-trac] [WordPress Trac] #38929: WP_Hook should support filters added manually through `advanced-cache.php`

WordPress Trac noreply at wordpress.org
Fri Nov 25 00:47:35 UTC 2016


#38929: WP_Hook should support filters added manually through `advanced-cache.php`
--------------------------+-----------------------
 Reporter:  dd32          |       Owner:  dd32
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.7
Component:  Plugins       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  commit        |     Focuses:
--------------------------+-----------------------

Comment (by dd32):

 Replying to [comment:3 azaozz]:
 > Replying to [comment:1 dd32]:
 > > ...anyone modifying `$wp_filter` directly shouldn't probably be doing
 so anyway after WordPress loads.
 >
 > Don't think anybody should be modifying `$wp_filter` directly in any
 case. Do you think it is a good idea to add "Doing it wrong..." somewhere?
 Perhaps in `WP_Hook::build_preinitialized_hooks()` as it exists to fix
 that "bad behavior".

 I don't see a huge benefit in doing that, as it'll only get triggered for
 existing use-cases that had to use that method pre-4.6.
 The only case of that that we really care about is when people do that
 much later in the load process, where `add_action()` would've previously
 been available. It's way too hard to catch that though right now, but will
 at least throw a PHP Notice now if it's an existing hook (a hook with no
 filters though would cause a fatal, I'm not convinced that adding extra
 checks to `apply_filters()` or `do_action()` to catch that scenario is
 worth it)

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


More information about the wp-trac mailing list