[wp-trac] [WordPress Trac] #63608: Hooked blocks not inserted
WordPress Trac
noreply at wordpress.org
Mon Jul 7 15:24:34 UTC 2025
#63608: Hooked blocks not inserted
--------------------------+------------------------------
Reporter: leewillis77 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 6.8
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by leewillis77):
> This is expected behavior. The crucial part is that the anchor block is
inserted after the plugin that contains the hooked block is activated.
Thanks for clarifying. I've tested and confirm that in the case you
described, the hooked blocks do appear.
> The underlying idea is that Block Hooks were always meant as a way to
auto-insert blocks upon plugin activation into existing layout and
content, but not necessarily if a user adds a new anchor block "after the
fact" (at which point they can arguably also add the otherwise hooked
block while they're in the editor). @leewillis77 Is that an acceptable
limitation for your use case, or does it make Block Hooks unviable for
you?
It makes it unviable for us I'm afraid (and creates a confusing experience
for the user IMHO).
What we're trying to replicate with hooked blocks is simply to replicate
the same effect as you'd get by using `add_action()` to attach a callback
to a `do_action()` in a theme template file - e.g. the hooked output is
added automatically *wherever* that template is used. It seems there's
still no mechanism to do that with blocks.
If you'd like more context, feel free to check out this related
discussion:
https://github.com/woocommerce/woocommerce/discussions/44776#discussioncomment-11302618
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63608#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list