-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Pattern overrides: ensure an additional meta capability for override capability #57940
Comments
Thanks so much for kicking this off @annezazu! To add some additional context around this, one use case that I'm thinking of is a related posts block on a media site. For that you might want:
|
Thanks for the question @aaronjorbin! We're presently using the existing capabilities at the moment:
|
Related: #28895 (comment) |
I don't think this issue should have the I also learned that so far in the editor, some features are gated through block editor setting, like Block Locking Settings in WordPress 6.0. While it works pretty well, it isn't the simplest thing to discover, see example: add_filter(
'block_editor_settings_all',
function( $settings, $context ) {
// Allow for the Editor role and above - https://wordpress.org/support/article/roles-and-capabilities/.
$settings['canLockBlocks'] = current_user_can( 'delete_others_posts' );
// Only enable for specific user(s).
$user = wp_get_current_user();
if ( in_array( $user->user_email, [ '[email protected]' ], true ) ) {
$settings['canLockBlocks'] = false;
}
// Disable for posts/pages.
if ( $context->post && $context->post->post_type === 'page' ) {
$settings['canLockBlocks'] = false;
}
return $settings;
},
10,
2
); Interestingly enough, by design, this feature is enabled in the UI through the client-side setting that only gets modified if a different setting is set on the server through this filter: gutenberg/packages/block-editor/src/store/defaults.js Lines 157 to 158 in 82bc72d
This issue is also related to an existing issue for regular patterns: |
Pulling this question out of yesterday's hallway hangout on WordPress 6.5:
This was underscored by others on the call as important to have. You can listen to the question/discussion starting here. It's only 1-2 minutes! Can someone chime in to clarify? @talldan as we chatted a bit about this. @aaronjorbin so you know this has been followed up on.
The text was updated successfully, but these errors were encountered: