• I’m working with Advanced Custom Fields (ACF) to create custom blocks for the WordPress Gutenberg editor. I have designed a parent block named “Tabs” that can contain multiple inner blocks, each named “Tab”.

    Here’s a simple representation of what I’m trying to achieve:

    // Parent Block: Tabs (render.php file)
    <Tabs>
      <InnerBlocks />
    </Tabs>
    
    // InnerBlock: Tab (render.php file)
    // Inside this block, I need to access the ID of the parent (Tabs) 
    // and also the current index or position of this inner block (Tab).
    

    My challenge is to access:

    1. The ID of the parent block (Tabs) from inside each Tab inner block.
    2. The current index or position of the Tab inner block within the inner block itself.

    Given that I’m using ACF for block creation, how might I retrieve this information in the render.php file of my custom blocks?

    Has anyone worked on something similar or can guide me through this?

  • The topic ‘How to Access Parent Block ID and Index of Current InnerBlock in Gutenberg Custo’ is closed to new replies.