Skip to content

Commit

Permalink
Backporting core changes from WordPress/wordpress-develop#4845 (#52709)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd authored Jul 18, 2023
1 parent 211713c commit 605e718
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/compat/wordpress-6.3/footnotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ function gutenberg_trim_footnotes( $content ) {
return $content;
}

static $footnote_pattern = '_<sup data-fn="[^"]+" class="[^"]+">\s*<a href="[^"]+" id="[^"]+">\d+</a>\s*</sup>_';
return preg_replace( $footnote_pattern, '', $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
);
}

add_filter( 'the_content', 'gutenberg_trim_footnotes' );

0 comments on commit 605e718

Please sign in to comment.