| @@ -53,8 +53,15 @@ | ||
| 53 | 53 | ]; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public static function init( string $content, $block, $instance ) : string { |
| 57 | + // This filter runs for EVERY block on the page (including core and | |
| 58 | + // third-party blocks). The regex in parse() is expensive, so skip it | |
| 59 | + // unless the block actually contains a dynamic-content marker. | |
| 60 | + if ( false === strpos( $content, 'ablocks_dc' ) | |
| 61 | + && false === strpos( $content, 'ablocks-richtext-dynamic-content' ) ) { | |
| 62 | + return $content; | |
| 63 | + } | |
| 57 | 64 | $ins = new self( $content, $instance->context ); |
| 58 | 65 | return $ins->content; |
| 59 | 66 | } |
| 60 | 67 | } |