Last active
October 29, 2025 18:20
-
-
Save bacoords/0721572f1e7345cf338028f49f6b6fa1 to your computer and use it in GitHub Desktop.
Remove all WooCommerce core patterns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'init', function() { | |
| $all_patterns = WP_Block_Patterns_Registry::get_instance()->get_all_registered(); | |
| foreach ( $all_patterns as $pattern ) { | |
| if ( isset( $pattern['name'] ) && strpos( $pattern['name'], 'woocommerce-blocks' ) === 0 ) { | |
| // $pattern['name'] is a WooCommerce pattern name. | |
| unregister_block_pattern($pattern['name'] ); | |
| } | |
| } | |
| }, 20 ); | |
| /** | |
| * Disables the WooCommerce Pattern Toolkit Full Composability feature. | |
| * | |
| * This feature is a flag for advanced block patterns functionality, which can | |
| * sometimes be tied to large transients/caching issues. | |
| */ | |
| add_filter( 'woocommerce_admin_features', function( $features ) { | |
| $feature_to_disable = 'pattern-toolkit-full-composability'; | |
| // Find the feature's identifier in the array and remove it. | |
| if ( ( $key = array_search( $feature_to_disable, $features ) ) !== false ) { | |
| unset( $features[ $key ] ); | |
| } | |
| return $features; | |
| } ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment