Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #62791


Ignore:
Timestamp:
01/08/2025 09:40:02 PM (14 months ago)
Author:
sabernhardt
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #62791

    • Property Component changed from General to Editor
  • Ticket #62791 – Description

    initial v1  
    1 In the course of some investigations, I noticed that [`pre_render_block`](https://github.com/WordPress/wordpress-develop/blob/d2a7bee9a6201f0276492ff29afd8c509480d266/src/wp-includes/blocks.php#L2113) comes before [ `render_block_data](https://github.com/WordPress/wordpress-develop/blob/d2a7bee9a6201f0276492ff29afd8c509480d266/src/wp-includes/blocks.php#L2151)
    2  and [`render_block_context`](https://github.com/WordPress/wordpress-develop/blob/d2a7bee9a6201f0276492ff29afd8c509480d266/src/wp-includes/blocks.php#L2187)
     1In the course of some investigations, I noticed that [https://github.com/WordPress/wordpress-develop/blob/d2a7bee9a6201f0276492ff29afd8c509480d266/src/wp-includes/blocks.php#L2113 `pre_render_block`] comes before [https://github.com/WordPress/wordpress-develop/blob/d2a7bee9a6201f0276492ff29afd8c509480d266/src/wp-includes/blocks.php#L2151 `render_block_data`] and [https://github.com/WordPress/wordpress-develop/blob/d2a7bee9a6201f0276492ff29afd8c509480d266/src/wp-includes/blocks.php#L2187 `render_block_context`]
    32
    4 This means I am not able to conditionally use `pre_render_block` with conditions based on either block context or programatically added attributes. This seems limiting. (or at least it is in my current project, where I am trying to modify an existing block when it's part of my block - using my block's context)
     3This means I am not able to conditionally use `pre_render_block` with conditions based on either block context or programmatically added attributes. This seems limiting. (or at least it is in my current project, where I am trying to modify an existing block when it's part of my block - using my block's context)
    54
    6 Could `pre_render_block` come before actual rendering, but after these other filters? Or could we add another filter at the beginning of [`render()`](https://github.com/WordPress/wordpress-develop/blob/287b2f8c961e8a67b2a232d37273b6ddfa611c28/src/wp-includes/class-wp-block.php#L451)?
     5Could `pre_render_block` come before actual rendering, but after these other filters? Or could we add another filter at the beginning of [https://github.com/WordPress/wordpress-develop/blob/287b2f8c961e8a67b2a232d37273b6ddfa611c28/src/wp-includes/class-wp-block.php#L451 `render()`]?
    76
    87