Skip to content

Commit c324f86

Browse files
committed
26649-strip-shortcodes-tag
1 parent 8d24041 commit c324f86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wp-includes/shortcodes.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,9 @@ function strip_shortcodes( $content ) {
757757
function strip_shortcode_tag( $m ) {
758758
// Allow [[foo]] syntax for escaping a tag.
759759
if ( '[' === $m[1] && ']' === $m[6] ) {
760-
return substr( $m[0], 1, -1 );
760+
// Convert escaped shortcode to HTML entities to prevent unexpected execution
761+
// when do_shortcode() is called later (e.g., in excerpt generation).
762+
return '[' . substr( $m[0], 2, -2 ) . ']';
761763
}
762764

763765
return $m[1] . $m[6];

0 commit comments

Comments
 (0)