Home Forums ACF PRO Retrieving ACF Block ID from within the block


Retrieving ACF Block ID from within the block

  • Hey all,

    Working on a block that shares its ACF data with Javascript to create data visuals on the front end by localizing the script.

    This is all working out. However, I am trying to account for the possibility that these data visual blocks may be used more than once on a page. I was hoping to use the block ID as the HTML ID so that JS knows where to render the visuals.

    Getting the block ID outside the block is doable. However, I also need to retrieve the block ID from within the block and render it as the ID the for the HTML root element.

    I have not been able to find a built-in method or workaround that allows me to do so.

    Has anyone been able to do this?

  • I’m very interested in this as well. Any chance someone can help out?

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

You must be logged in to reply to this topic.