W3cubDocs

/WordPress

excerpt_remove_footnotes( string $content ): string

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

Parameters

$contentstringrequired
The content to parse.

Return

string The parsed and filtered content.

Source

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
	);
}

Changelog

Version Description
6.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/excerpt_remove_footnotes