0

I want to remove this setting from the core block "file":

enter image description here

I've tried to do this in theme.json

{
"version": 2,
"settings": {
    "blocks": {
        "core/file": {
            "showDownloadButton": false
        }
    }
}

}

But it doesn't work. Anybody know how to accomplish this? I feel like the documentation for all things Gutenberg is a bit lackluster? Or maybe I'm just bad at finding what I want.

1 Answer 1

0

Not sure if you were able to get this working, but i did this using the register_block_type_args filter in our functions.php

 function show_download_button( $settings, $blockname ) {
    
        // Check for block type.
        if ( $blockname !== 'core/file' ) {
    
            return $settings;
        }
    
        $downloadbutton = [
            'type'    => 'boolean',
            'default' => false,
        ];
    
        $settings['attributes']['showDownloadButton'] = $downloadbutton;
    
        return $settings;
    }
    
    
    add_filter( 'register_block_type_args', 'show_download_button', 10, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.