-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patterns: add a custom taxonomy for user created patterns (#53163)
- Loading branch information
1 parent
ff06828
commit 4da51a1
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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' ); |
This file contains 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