Patterns: add a custom taxonomy for user created patterns#53163
Patterns: add a custom taxonomy for user created patterns#53163glendaviesnz merged 6 commits intotrunkfrom
Conversation
|
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/compat/wordpress-6.4/block-patterns.php ❔ lib/load.php |
|
Flaky tests detected in cc8887b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5710416307
|
spacedmonkey
left a comment
There was a problem hiding this comment.
I am not sure this is needed in core. Where will this functionality to used in core? Why would we not just use post meta?
|
@spacedmonkey, see #53164. |
|
Sorry @spacedmonkey, I should have included the link to the overview issue in the PR description. Let me know if you still have concerns after reading that. |
|
@spacedmonkey are you able to confirm if you are happy with this or not after reading the background issue? |
00da444 to
7d2eae1
Compare
|
@Mamaduka it looks like @spacedmonkey is away until September and it would be good to move this forward. There was agreement over on the issue that this is the right way forward for this, so do you think it is ok to override the blocker on this PR? |
Mamaduka
left a comment
There was a problem hiding this comment.
@glendaviesnz, that sounds good to me 👍
| $args = array( | ||
| 'hierarchical' => false, | ||
| 'labels' => $labels, | ||
| 'show_ui' => true, | ||
| 'show_in_menu' => false, | ||
| 'show_in_nav_menus' => false, | ||
| 'show_admin_column' => true, | ||
| 'query_var' => true, | ||
| 'show_in_rest' => true, | ||
| '_builtin' => true, | ||
| 'rewrite' => array( 'slug' => 'wp_pattern_category' ), |
There was a problem hiding this comment.
- We can set
show_uitofalse; the post type has no admin menu, which will do nothing. - REST API will mainly consume the taxonomy, so it's not publicly queriable. Related arguments (
query_var,rewrite,public) will need to be adjusted.
That would give us pretty much the same argument shape as wp_template_part_area - https://github.com/WordPress/wordpress-develop/blob/8cd99074624a8c4b589f31c7b2a8092f4fe5c79e/src/wp-includes/taxonomy.php#L207-L224
There was a problem hiding this comment.
The PostTaxonomies component only checks for show_ui, not the other arguments.
Considering that the new taxonomy does very little without remaining work from #53164. I think it's okay to hide UI.
There was a problem hiding this comment.
true, have removed the UI for now at least.

What?
Adds a custom taxonomy to allow users to organize the synced and unsynced patterns that they create.
Why?
Currently there is no way for users to classify their own patterns.
This would be step one to implement #53164 - see further discussion there.
How?
Adds a standard WP custom taxonomy called
wp_pattern_custom_category.Currently this just adds the base taxonomy. The post and site editor UI to make use of the UI will be added in follow-up PRs if this approach of using a custom taxonomy is accepted.
Testing Instructions
/wp-admin/edit.php?post_type=wp_blockand add a new patternScreenshots or screencast
categories.mp4