Skip to content

Commit

Permalink
Gutenberg Block Parsing: Bail earlier with a quick check if the block…
Browse files Browse the repository at this point in the history
… isn't being used.
  • Loading branch information
Viper007Bond committed Nov 17, 2018
1 parent 1f8ee8e commit 1896a9b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions syntaxhighlighter.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ function enable_brushes_used_in_blocks( $content ) {
return $content;
}

// Lower overhead than a full parse.
if ( ! has_block( 'syntaxhighlighter/code', $content ) ) {
return $content;
}

$blocks = gutenberg_parse_blocks( $content );

foreach ( $blocks as $block ) {
Expand Down

0 comments on commit 1896a9b

Please sign in to comment.