Replies: 1 comment
-
Okay it seems that the Is it a known bug that you cannot use the callback function inside the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there. I created a dynamic block using the create-block script:
npx @wordpress/create-block@latest --namespace my-namespace --no-plugin my-block --variant dynamic
This creates a
my-block
folder inside my theme'sassets/blocks
folder.In my theme's
functions.php
I register all my blocks like so:My block's render.php file looks like this:
For testing purposes I left the other files as they were created by the script. In the full site editor the "My Block" block is available and can be added to the page and gets rendered in the backend. But nothing gets rendered in the frontend. I tested if the
render.php
gets loaded and changed the content to basic html:<p>Hello worlds!</p>
This works. I also tried to
echo
anddie
inside the render callback function. The callback function simply doesn't get called. I double checked that the callback function name is correct.Is there anything missing to make the render callback function work? Thanks in advance.
EDIT:
Calling the render callback function inside register_block_type function directly works as well:
Beta Was this translation helpful? Give feedback.
All reactions