Remove the Lock option from the block toolbar for everyone except administrators, so editors can't lock or unlock blocks.
add_filter( 'block_editor_settings_all', function ( array $settings ): array {
if ( ! current_user_can( 'manage_options' ) ) {
$settings['canLockBlocks'] = false;
}
return $settings;
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Block locking stops blocks being moved or removed, which is useful for keeping layouts intact. But if editors can lock and unlock blocks themselves, the protection is easy to undo. This snippet keeps locking for administrators only.
canLockBlocks in the editor settings controls whether the Lock option appears in the block toolbar and List View. The snippet sets it to false for anyone without manage_options. Blocks an administrator has locked stay locked for everyone else.
template_lock on a post type, aren’t affected.Log in as an editor and click a block’s options menu. There should be no Lock option.