Restrict Block Locking to Administrators
Only administrators can lock and unlock blocks, so locked layouts stay intact when other users edit content.
Opens WPIDE on
Code
add_filter( 'block_editor_settings_all', function ( $settings ) {
$settings['canLockBlocks'] = current_user_can( 'manage_options' );
return $settings;
} );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.