Skip to content

Instantly share code, notes, and snippets.

@indextwo
indextwo / functions.php
Created April 29, 2021 16:04
WordPress/Gutenberg: Automatically create a list of links to anchor points in headings
<?php
// Create an array to put out anchor links into
$anchorLinks = array();
// We're going to parse out the blocks of the current page's content
$blocks = parse_blocks(get_the_content());