[wp-trac] [WordPress Trac] #59551: Respect non-null values from the `pre_render_block` filter

WordPress Trac noreply at wordpress.org
Thu Oct 5 20:05:48 UTC 2023


#59551: Respect non-null values from the `pre_render_block` filter
--------------------------+------------------------------
 Reporter:  danieliser    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by pbiron):

 Maybe I'm misunderstanding, but core's use of that filter seems perfectly
 fine to me.

 1. core does hook into the filter at the default priority (10).  but it
 does that during the bootstrap process before plugins (or themes) are
 loaded.  So, any plugin/theme that hooks into the filter at the default
 priority will have their callback fired **after** core's callback...which
 is what they'd want.

 2. core's callbacks for that filter return ''null'' precisely because core
 does **not** want it's callbacks to short-circuit the rendering of the
 block.  Thus, in effect, core is treating the filter more like an action.
 If a plugin/theme hooks into the filter (at any priority of 10 or more)
 and **does** return a non-null value (assuming their callback is the last
 one called), then their non-null return value **will** be honored (and the
 rendering of the block will be short-circuited...which is what is supposed
 to happen.

 Can you please explain more about why you think there is a problem?

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


More information about the wp-trac mailing list