-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patterns: add a custom taxonomy for user created patterns #53163
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We can set
show_ui
tofalse
; 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true, have removed the UI for now at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Glen!
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_block
and add a new patternScreenshots or screencast
categories.mp4