From 1896a9b01c5cd5f166c29cc21b93a718f049bf5c Mon Sep 17 00:00:00 2001 From: Alex Mills Date: Fri, 16 Nov 2018 16:03:24 -0800 Subject: [PATCH] Gutenberg Block Parsing: Bail earlier with a quick check if the block isn't being used. --- syntaxhighlighter.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/syntaxhighlighter.php b/syntaxhighlighter.php index 4371183..6e5f84f 100644 --- a/syntaxhighlighter.php +++ b/syntaxhighlighter.php @@ -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 ) {