excerpt_remove_footnotes()WP 6.3.0

Parses footnotes markup out of a content string, and renders those appropriate for the excerpt.

No Hooks.

Return

String. The parsed and filtered content.

Usage

excerpt_remove_footnotes( $content );
$content(string) (required)
The content to parse.

Changelog

Since 6.3.0 Introduced.

excerpt_remove_footnotes() code WP 6.7.1

function excerpt_remove_footnotes( $content ) {
	if ( ! str_contains( $content, 'data-fn=' ) ) {
		return $content;
	}

	return preg_replace(
		'_<sup data-fn="[^"]+" class="[^"]+">\s*<a href="[^"]+" id="[^"]+">\d+</a>\s*</sup>_',
		'',
		$content
	);
}