Support

Account

Home Forums Gutenberg Passing a variable to custom block from inside the editor.

Helping

Passing a variable to custom block from inside the editor.

  • Hello,

    I need to pass the custom post type slug as a variable to a custom block made with ACF. This needs to happen when the block is placed for the first time in the editor.

    What I want to achieve, is that the block detects the post type and then stores that value so it can be used when rendering the block in the frontend. It can not be done by css classes (that would be the obvious solution). I need to be able to output the CPT slug as a string in the single CPT page.

    Con anyone give me a hint on how to achieve this?

    Thank you!

  • I am also trying to pass a global select-type variable of the parent.block to all the inner.blocks. Is it possible?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.