From fcffad860da402f0790f36b14c5661b755f141ff Mon Sep 17 00:00:00 2001 From: ramon Date: Tue, 18 Jul 2023 10:29:27 +1000 Subject: [PATCH] Backporting core changes from https://github.com/WordPress/wordpress-develop/pull/4845 --- lib/compat/wordpress-6.3/footnotes.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/compat/wordpress-6.3/footnotes.php b/lib/compat/wordpress-6.3/footnotes.php index 45f4c74b05e37..6225b280e1b6c 100644 --- a/lib/compat/wordpress-6.3/footnotes.php +++ b/lib/compat/wordpress-6.3/footnotes.php @@ -18,8 +18,15 @@ function gutenberg_trim_footnotes( $content ) { return $content; } - static $footnote_pattern = '_\s*\d+\s*_'; - return preg_replace( $footnote_pattern, '', $content ); + if ( ! str_contains( $content, 'data-fn=' ) ) { + return $content; + } + + return preg_replace( + '_\s*\d+\s*_', + '', + $content + ); } add_filter( 'the_content', 'gutenberg_trim_footnotes' );