WordPress Block Locking API: Control Editor Permissions in FSE Themes

Gutenberg’s Block Locking API lets theme and plugin authors restrict how editors interact with blocks — preventing moves, removes, or attribute edits. In FSE themes this is critical for enforcing layout integrity while still allowing content updates.


Pass lock attributes directly in theme.json template markup or via register_block_type to control per-block permissions programmatically.


// Lock a block in a synced pattern via PHP
add_filter( 'register_block_type_args', function( $args, $name ) {
    if ( 'core/image' === $name ) {
        $args['lock'] = [
            'move'   => true,
            'remove' => true,
        ];
    }
    return $args;
}, 10, 2 );

// Or in template JSON (theme.json templateParts)
// "lock": { "move": true, "remove": true }


NOTE: Block locking does not affect admin-role users by default — use block_editor_settings_all filter to extend restrictions to all roles.