Repository navigation
Add create taxonomies beta in editor sidebar - #549
Open
faisalahammad wants to merge 2 commits into
Open
faisalahammad wants to merge 2 commits into
faisalahammad wants to merge 2 commits into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Adds an opt-in beta feature that lets admins create a taxonomy straight from the post editor sidebar. The form takes the essential settings only (labels, key, hierarchical) and binds the new taxonomy to the post type being edited. The beta flag could never turn on before because the registry included a missing class file and registered no features, so that path is fixed as part of this. New REST endpoint /scf/v1/taxonomies handles the create request with the same validation rules as the classic admin screen (reserved keys, duplicates, key charset and length). See WordPress#155
Trunk renamed the editor preview menu item to "Preview (opens in a new tab)", which no longer matches the exact label the e2e helpers look for, so every preview test timed out waiting for the new page. Match on the shared "Preview ... new tab" text instead, which works on all the supported WordPress versions.
faisalahammad
force-pushed
the
enhancement/155-create-taxonomy-editor
branch
from
September 24, 2026 22:48
6a6e8a5 to
7563d02
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in beta feature that lets admins create a taxonomy without leaving the post editor. The panel lives in the document settings sidebar and shows only the essential settings: singular label, plural label, taxonomy key and the hierarchical toggle. The new taxonomy is bound to the post type currently being edited, so it is ready to use on that screen straight away.
This covers the creation half of the request in #155. Editing and deleting taxonomies still happen on the existing Taxonomies screen, which is unchanged.
How it works
A new REST route,
POST /scf/v1/taxonomies, handles the create request. It reuses the same input mapping, capability check and validation rules as the classic admin save path inadmin-taxonomy.php, then persists throughacf_update_internal_post_type(). Reserved keys (post_tag,category,nav_menu, and the other built in ones), duplicate keys and invalid keys are rejected with a specific error, so the sidebar does not need to duplicate that logic to stay safe.The sidebar UI is a small plugin registered with
PluginDocumentSettingPanel, so it sits with the other document settings rather than a modal. The key is derived from the singular label until the user edits it, and the panel is hidden on internalwp_*entities and on post types that are not shown in the admin.The classic creation flow is untouched, and the whole feature is behind the
create_taxonomiesbeta flag.Beta registry fix
The beta flag could not be turned on before this PR.
include_beta_features()referenced a class file that does not exist, andregister_beta_features()registered nothing, so the Features screen had no entries to toggle. That path is fixed here so the new flag actually works. Registering the features also brings back the existingeditor_sidebarentry, which had the same problem.How to test
book.categoryor an existing key, and confirm the panel shows a clear error instead of creating anything.POST /wp-json/scf/v1/taxonomiesreturns 404.Tests run
composer test:php- full PHPUnit suite, 2953 tests pass. New coverage intests/php/includes/rest-api/SCFRestCreateTaxonomyTest.phpfor the endpoint (success, duplicate, reserved, invalid key, unknown post type, permissions, and the route being absent when the beta is off).composer test:phpstan- clean on the changed files.composer lint:php- clean on the changed lines.npm run test:unit- full Jest suite passes, including the new validation tests.npm run build- builds without errors.See #155