Use lower priority for block context filters#4780
Use lower priority for block context filters#4780dlh01 wants to merge 1 commit intoWordPress:trunkfrom
Conversation
|
Good catch; this admittedly didn't occur to me when working on WordPress/gutenberg#50313. I think your solution makes sense; I was briefly debating whether we should use a slightly higher value (e.g. 5) for priority in order to allow other filters to kick in earlier, but I think it's true that from a backwards-compat point-of-view, using the lowest possible value is the closest we can get to retain the previous behavior. However, this change will need to go "through" Gutenberg: As the e2e tests are flagging, blocks' dynamic PHP code is synced from the I'll go ahead and will file a GB PR 😊 |
| * have access to the values. | ||
| */ | ||
| add_filter( 'render_block_context', $filter_block_context ); | ||
| add_filter( 'render_block_context', $filter_block_context, 0 ); |
There was a problem hiding this comment.
One minor note: The docs say that
priorities are positive integers, typically between 1 and 20
| add_filter( 'render_block_context', $filter_block_context, 0 ); | |
| add_filter( 'render_block_context', $filter_block_context, 1 ); |
|
|
Per #4780 (comment), I'll go ahead and close this PR. The suggested fix is over at WordPress/gutenberg#52364 😊 |
Trac ticket: https://core.trac.wordpress.org/ticket/58699