You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 28, 2023. It is now read-only.
@DAreRodz shared the following feedback with me in Slack:
I have a couple of questions regarding directives evaluation and wp-context:
I see that directives run inside wp_process_directives(), a callback added to the render_block hook—dispatched every time a block has rendered—, and uses WP_HTML_Tag_Processor to iterate over the HTML content, find the directives, and execute them.
The questions are:
Isn’t that callback running several times for the same HTML?. E.g., if you have a block A and a block B inside A, both blocks will dispatch render_block when rendered. Won’t B's directives run twice, one when render_block is dispatched for B and a second one for A (that would include B in its $block_content)?
WP_Directive_Context is instantiated for each render_block execution. Doesn’t it create a different context stack for each block? I guess it works in the end because we run directives inside inner blocks again (as mentioned in question 1.)?