Adding HTML Anchor in Custom ACF Blocks

To add functionality that allows you to add an HTML (ID) anchor to a section, add the following supports when you register your custom ACF block:

'supports' => array( 'anchor' => true ),

Remember to add it to your markup using:

id="<?php echo esc_attr( $block['anchor'] ); ?>"

One thought on “Adding HTML Anchor in Custom ACF Blocks

Leave a Reply

Your email address will not be published. Required fields are marked *