Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Add filter to block pattern registration
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ public function register_patterns() {
}

foreach ( (array) $block_patterns as &$pattern ) {
if ( $this->can_register_pattern( $pattern ) ) {
/**
* Filter whether a pattern should be registered.
*
* @param bool $should_register Whether the pattern should be registered. Default true.
* @param array $pattern The pattern data array.
*/
$should_register = apply_filters( 'jetpack_block_patterns_should_register', true, $pattern );

if ( $should_register && $this->can_register_pattern( $pattern ) ) {
$is_premium = isset( $pattern['pattern_meta']['is_premium'] ) ? boolval( $pattern['pattern_meta']['is_premium'] ) : false;

// Set custom viewport width for the pattern preview with a
Expand Down