[wp-trac] [WordPress Trac] #46991: Stop propagation on actions or filter

WordPress Trac noreply at wordpress.org
Fri Apr 19 12:05:17 UTC 2019


#46991: Stop propagation on actions or filter
-----------------------------+-----------------------------
 Reporter:  screamingdev     |      Owner:  (none)
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 It would be great to stop further filter-hooks/action-observer when we
 reached a state that should not continue.

 This helps especially for custom implementations:

 * Rejection actions that should not run.
 * Return filtered values without giving other plugins the chance to change
 them.

 All just for specific cases.

 Possible implementation:

 * Normal but impossible: Event-Class as wrapper reflecting whether to
 continue or stop.
 * Semi-normal-way: Throwing a exception like
 `\WP_Stop_Propagation_Exception` telling WP_Hook to stop.
 * Absolute absurd way: Setting a global variable like `$stop_propagation =
 true`

 ... and there may be more.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46991>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list