Skip to content

Commit 1896a9b

Browse files
committed
Gutenberg Block Parsing: Bail earlier with a quick check if the block isn't being used.
1 parent 1f8ee8e commit 1896a9b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

syntaxhighlighter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,11 @@ function enable_brushes_used_in_blocks( $content ) {
346346
return $content;
347347
}
348348

349+
// Lower overhead than a full parse.
350+
if ( ! has_block( 'syntaxhighlighter/code', $content ) ) {
351+
return $content;
352+
}
353+
349354
$blocks = gutenberg_parse_blocks( $content );
350355

351356
foreach ( $blocks as $block ) {

0 commit comments

Comments
 (0)