From 31d070efbc485f45e7a191900eb6d9dd27871fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Fri, 3 May 2024 12:01:25 +0200 Subject: [PATCH] fix remove all patterns in test environment --- example/plugin.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/example/plugin.php b/example/plugin.php index 9052eb24..a2d613c2 100644 --- a/example/plugin.php +++ b/example/plugin.php @@ -140,6 +140,18 @@ function() { } ); +add_action( 'wp_loaded', __NAMESPACE__ . '\remove_core_patterns' ); + +/** + * Remove core patterns + */ +function remove_core_patterns() { + $patterns = \WP_Block_Patterns_Registry::get_instance()->get_all_registered(); + foreach ( $patterns as $pattern ) { + unregister_block_pattern( $pattern['name'] ); + } +} + /** * Remove page level patterns