Repository navigation
Add opt-in editor sidebar for field groups (beta) - #548
Open
faisalahammad wants to merge 2 commits into
Open
faisalahammad wants to merge 2 commits into
faisalahammad wants to merge 2 commits into
Conversation
Wire the existing editor_sidebar beta feature into the registry and register eligible field group meta boxes with side context when the beta is enabled and the post type uses the block editor. Rewrite the saved meta box order so it cannot pull the boxes back out of the sidebar, and report the sidebar position from the check_screen AJAX response for dynamically added groups. Classic editor post types and the beta-off state are unchanged. See WordPress#154
|
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 block editor on WP trunk renamed the View menu item from "Preview in new tab" to "Preview (opens in a new tab)". The pinned e2e test helper still matches the old label exactly, so every test that opens a preview timed out. The fixture now clicks the button itself and matches the item with a regex that accepts both labels. Fixes the WP trunk E2E timeouts waiting for the preview page. Refs WordPress#548
This was referenced Sep 25, 2026
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.
Move field groups into the block editor sidebar behind an opt-in beta feature. When the beta is enabled and the post type uses the block editor, field groups are registered with
sidemeta box context so Gutenberg renders them in the editor sidebar natively. Field rendering, saving and validation stay on the existing paths.See #154
What changed
Beta feature is now reachable.
includes/admin/beta-features.phpincluded a class file that does not exist and had an empty registry, so theeditor_sidebarfeature could never appear. It now loadsclass-scf-beta-feature-editor-sidebar.phpand registers it. The feature shows up as "Move Elements to Editor Sidebar" under Field Groups > Beta Features.Sidebar placement.
includes/api/api-helpers.phpadds threescf_helpers.scf_field_groups_use_editor_sidebar()returns true only when the beta is on anduse_block_editor_for_post_type()accepts the post type.includes/forms/form-post.phpuses it to switch the meta box context of groups positionednormal,advancedoracf_after_titletoside, keeping the existingacf/input/meta_box_priorityfilter andcorepriority.Saved order cannot undo the move. WordPress re-registers meta boxes from the saved
meta-box-order_{screen}user option, which pulls them back out of the sidebar.form-post.phpandincludes/ajax/class-acf-ajax-check-screen.phprewrite that option for the affected box IDs, same approach as the existingacf_after_titlehandling inACF_Form_Gutenberg. The check_screen response also reports the sidebar position for groups added dynamically.E2E fixture for the renamed preview menu item.
tests/e2e/fixtures.jsis a test only change, included to get the WP trunk E2E matrix green. The editor View menu item was renamed to "Preview (opens in a new tab)" in Gutenberg, and the pinned@wordpress/e2e-test-utils-playwright@1.32.0helper still matches the old label exactly, so all 39 tests that open a preview timed out on trunk. The fixture now clicks the button itself and matches the menu item with a regex that accepts both labels. Nothing in this PR depends on it. See the CI Fix Summary comment for the details.Before / After
How to test
Expected: with the beta on and the block editor in use, field groups appear in the sidebar and still save. With the beta off, or on a classic editor post type, nothing changes.
For the fixture change, run the E2E suite against WP trunk and expect no preview timeouts. WP 6.9 and WP latest cover the older label and should keep passing:
Testing done
tests/php/EditorSidebarBetaTest.phpfor feature registration, position switching, classic editor fallback, unknown post types and saved order rewrites, plus a check_screen response test.wp-scripts lint-jsclean on the changed fixture.Notes
@wordpress/e2e-test-utils-playwrightto 2.x is the durable fix for the preview label, but 2.x matches only the new label and would break WP 6.2, 6.9 and latest. A helper bump belongs in its own PR.