admin管理员组

文章数量:1125076

I was wondering if there is any way to: replace a Gutenberg block (in this case the navigation), with ESI, + fetch this block in another endpoint the ESI tag points to. In classic themes this is fairly easy because you can get nav + id.

Haven't found something like this with blocks (render_block contains a reference like core/navigation but it isn't unique).

I was wondering if there is any way to: replace a Gutenberg block (in this case the navigation), with ESI, + fetch this block in another endpoint the ESI tag points to. In classic themes this is fairly easy because you can get nav + id.

Haven't found something like this with blocks (render_block contains a reference like core/navigation but it isn't unique).

Share Improve this question edited Feb 5, 2024 at 22:16 WpToon asked Feb 5, 2024 at 22:12 WpToonWpToon 12 bronze badges 1
  • What is ESI? Edge side includes? – Lovor Commented Feb 10, 2024 at 10:40
Add a comment  | 

1 Answer 1

Reset to default 0

I am not sure If I get what you meant, but study https://developer.wordpress.org/reference/hooks/render_block_this-name/ filter, whan calling it give it $accepted_args number of 3 and inspect what is returned in $block_content or $instance. ID is encoded as ref attribute, if that's what you are missing.

You could also use render_block filter, but render_block_{$this->name} is more convenient, since it is called just for block type specified in filter name.

本文标签: hooksReplacing specific Gutenberg blocks