From 4da51a1b1756b1d67c72fbe1182ebf141ca05ff0 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Thu, 17 Aug 2023 18:07:04 +1200 Subject: [PATCH] Patterns: add a custom taxonomy for user created patterns (#53163) --- lib/compat/wordpress-6.4/block-patterns.php | 36 +++++++++++++++++++++ lib/load.php | 1 + 2 files changed, 37 insertions(+) create mode 100644 lib/compat/wordpress-6.4/block-patterns.php diff --git a/lib/compat/wordpress-6.4/block-patterns.php b/lib/compat/wordpress-6.4/block-patterns.php new file mode 100644 index 00000000000000..aa4c5ef378bc7a --- /dev/null +++ b/lib/compat/wordpress-6.4/block-patterns.php @@ -0,0 +1,36 @@ += 6.4. + * + * @see https://github.com/WordPress/gutenberg/pull/53163 + * + * @return void + */ +function gutenberg_register_taxonomy_patterns() { + $args = array( + array( + 'public' => false, + 'hierarchical' => false, + 'labels' => array( + 'name' => _x( 'Pattern Categories', 'taxonomy general name' ), + 'singular_name' => _x( 'Pattern Category', 'taxonomy singular name' ), + ), + 'query_var' => false, + 'rewrite' => false, + 'show_ui' => false, + '_builtin' => true, + 'show_in_nav_menus' => false, + 'show_in_rest' => true, + ), + ); + register_taxonomy( 'wp_pattern_category', array( 'wp_block' ), $args ); +} +add_action( 'init', 'gutenberg_register_taxonomy_patterns' ); diff --git a/lib/load.php b/lib/load.php index ec3cddf56d257f..03416c87887694 100644 --- a/lib/load.php +++ b/lib/load.php @@ -121,6 +121,7 @@ function gutenberg_is_experiment_enabled( $name ) { // WordPress 6.4 compat. require __DIR__ . '/compat/wordpress-6.4/blocks.php'; +require __DIR__ . '/compat/wordpress-6.4/block-patterns.php'; // Experimental features. require __DIR__ . '/experimental/block-editor-settings-mobile.php';