Skip to content

Commit

Permalink
Patterns: add a custom taxonomy for user created patterns (#53163)
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz authored Aug 17, 2023
1 parent ff06828 commit 4da51a1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions lib/compat/wordpress-6.4/block-patterns.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Overrides Core's wp-includes/block-patterns.php to add new wp_patterns taxonomy for WP 6.4.
*
* @package gutenberg
*/

/**
* Adds a new taxonomy for organizing user created patterns.
*
* Note: This should be removed when the minimum required WP version is >= 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' );
1 change: 1 addition & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 4da51a1

Please sign in to comment.