-
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
Meta Boxes Not Rendered for Block Patterns (wp_block
)
#67902
Comments
I believe this is intentional. The Synced Patterns don't support meta boxes. @t-hamano, @stokesman, can you confirm this? |
That's right. We can edit a pattern by selecting a synced pattern in the post editor and clicking "Edit original". However, the meta boxes displayed there are tied to the original post, which can be confusing. However, if we're Just to be safe, I'll move this issue to the 6.7.x project board. |
This was changed in #64990 to fix #64914 (and it’s not dependent on the split view).
I think so. Further, even if it’s edited through "Edit original" if it’s possible to show only meta boxes tied to the focused post type that would seem nice to have. |
A quick fix to make the metabox visible when editing the pattern directly: Detailsdiff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js
index b0a2b3f7d7..667fcb0de7 100644
--- a/packages/edit-post/src/components/layout/index.js
+++ b/packages/edit-post/src/components/layout/index.js
@@ -405,6 +405,9 @@ function Layout( {
const isRenderingPostOnly = getRenderingMode() === 'post-only';
const isNotDesignPostType =
! DESIGN_POST_TYPES.includes( currentPostType );
+ const isDirectlyEditingPattern =
+ currentPostType === 'wp_block' &&
+ ! onNavigateToPreviousEntityRecord;
return {
mode: getEditorMode(),
@@ -415,7 +418,9 @@ function Layout( {
!! select( blockEditorStore ).getBlockSelectionStart(),
showIconLabels: get( 'core', 'showIconLabels' ),
isDistractionFree: get( 'core', 'distractionFree' ),
- showMetaBoxes: isNotDesignPostType && ! isZoomOut(),
+ showMetaBoxes:
+ ( isNotDesignPostType && ! isZoomOut() ) ||
+ isDirectlyEditingPattern,
isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
templateId:
supportsTemplateMode &&
@@ -433,6 +438,7 @@ function Layout( {
currentPostId,
isEditingTemplate,
settings.supportsTemplateMode,
+ onNavigateToPreviousEntityRecord,
]
);
useMetaBoxInitialization( hasActiveMetaboxes );
Perhaps we'll have to re-run |
I quickly tested that and works for me.
It looks like it would take more than that because the meta boxes that are present are fixed when the editor loads. I guess navigating to directly edit the pattern is the simplest way but seems it should not be done automatically. A button to reload could be shown in the meta box area with some message like "A page reload is required to access any meta boxes for this pattern." However, I don’t think it can be known beforehand whether a pattern has any meta boxes so the button/message may not be applicable. Otherwise, there would have to be an endpoint that could retrieve meta boxes for a given post type but I suppose that requires patching WP core. |
Description
With the recent WordPress update introducing the Split Content View, meta boxes and the block editor are now separated into distinct areas. However, this update has introduced a critical issue: meta boxes are not displayed for Block Patterns (
wp_block
).Although all the registered meta boxes appear in the Preferences list, they are not rendered in the Split Content View (see screenshot below).
This issue is particularly impactful for plugins like MultilingualPress, which rely on meta boxes to manage translations for custom post types (e.g., translating block patterns into different locales). The absence of meta boxes makes it impossible to translate block patterns effectively.
Step-by-step reproduction instructions
wp_block
) section in the WordPress admin.Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: