feat(commands): add Command Palette commands for editing existing SCF data structures#516
Open
faisalahammad wants to merge 2 commits into
Open
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. |
The loader registered for each CPT was checking postType.visibility?.show_in_rest, but the WordPress core /wp/v2/types response does not include a visibility object. The show_in_rest signal is inferred from a non-empty rest_base. Derived hasRestSupport from rest_base && rest_namespace to gate the loader, and wrapped per-CPT registration in an async IIFE so one failure does not kill the rest. Added wp-core-data dependency for getEntityRecords resolution. E2E test seeds a published post and asserts the edit result navigates to the post editor. Fixes WordPress#138
faisalahammad
force-pushed
the
fix/138-command-palette-edit-cpt-instance
branch
from
July 21, 2026 17:26
77aea75 to
df544a2
Compare
Adds 'Edit' commands for field groups, taxonomies, and options pages in the
WordPress Command Palette (Cmd+K / Ctrl+K).
- Taxonomy commands: new scf_taxonomy_id REST field on /wp/v2/taxonomies
mirrors existing scf_post_id pattern, enabling per-taxonomy 'View Terms'
and 'Edit Taxonomy' commands with capability checks
- Field group commands: per-field-group 'Edit field group: {title}' commands
using PHP-injected data (acf-field-group has no REST endpoint)
- Options page commands: per-options-page 'Edit options page: {title}' commands
using PHP-injected data (acf-ui-options-page has no REST endpoint)
Fixes WordPress#137
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.
Summary
Adds Command Palette (Cmd+K / Ctrl+K) commands for editing existing SCF data structures: field groups, taxonomies, and options pages.
Previously, users could only list and add new data structures via the Command Palette. This adds per-item edit commands that navigate directly to the edit screen for each existing item.
Fixes #137
Changes
REST API: Taxonomy endpoint (
class-acf-rest-types-endpoint.php)Before: No REST field for taxonomy SCF internal post IDs.
After: New
scf_taxonomy_idfield on/wp/v2/taxonomies, mirroring existingscf_post_idon/wp/v2/types. Capability-gated: only exposed to users who can edit the taxonomy definition.Why: Enables the JS Command Palette to detect SCF-managed taxonomies and gate edit commands on the same capability check used for post types.
Taxonomy commands (
custom-post-type-commands.js)Before: No taxonomy commands.
After: Per-taxonomy commands:
scf/tax-{slug}— View Terms (gated oncanUser('edit', 'taxonomy', slug))scf/edit-tax-{slug}— Edit Taxonomy definition (gated onscf_taxonomy_idpresence)Why: Completes taxonomy coverage in the Command Palette, matching the existing CPT pattern.
Field group commands (
admin-commands.js+admin-commands.php)Before: No way to edit existing field groups from Command Palette.
After: Per-field-group
scf/edit-field-group-{key}commands with label "Edit field group: {title}". Data injected viawp_localize_scriptsinceacf-field-groupposts are not REST-accessible. Gated oncurrent_user_can('edit_post', ID).Why: Field groups lack a REST endpoint, so PHP-side data injection is the only path.
Options page commands (
admin-commands.js+admin-commands.php)Before: No way to edit existing options pages from Command Palette.
After: Per-options-page
scf/edit-options-page-{slug}commands with label "Edit options page: {title}". Data injected viawp_localize_scriptsinceacf-ui-options-pageposts are not REST-accessible. Gated oncurrent_user_can('edit_post', ID).Why: Same REST limitation as field groups; PHP injection is the only path.
Testing
Test 1: Taxonomy commands
Test 2: Field group commands
Test 3: Options page commands
Test 4: Capability checks