• In the past, when individual Jetpack features were separate modules, there was a (relatively) simple way to disable individual parts. (hooking into jetpack_get_available_modules and unsetting elements of $modules)

    What is the “correct” way to remove/disable new blocks? In my case, I wish to make the new Donations block inaccessible to users. Google isn’t being very helpful this morning — almost everything related to “disable blocks” is for disabling the block editor entirely, which is not what I want to do. I just need to disable an individual block.

    (Related: Does jetpack.com have a canonical list of the different blocks and modules, and their internal names, for when I need to disable different parts?)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor csonnek

    (@csonnek)

    Happiness Rocketeer 🚀

    @desmith Thanks for getting in touch!

    All the hooks and filters we have on our developer.jetpack.com site were all created pre-block editor, so that particular filter won’t impact any of the new blocks.

    This is a bit out of scope for our support forums here, but I encourage you to open a new request on our GitHub repository for the development team for consideration because that seems like something we should have!

    You can open a new issue here:
    https://github.com/Automattic/jetpack/issues/new

    Sorry I couldn’t be more help here – but let us know if we can help with anything else!

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I’m a bit late to the party, but I figured I’d chime in since other site owners may want to do the same thing in the future.

    I first would like to mention this plugin. It can be used to manage blocks on your site; it allows you to disable blocks you don’t want to make available to anyone on your site:
    https://wordpress.org/plugins/block-manager

    If you’d rather not add another plugin, you could use the jetpack_register_gutenberg_extensions action:
    https://developer.jetpack.com/hooks/jetpack_register_gutenberg_extensions/

    Here is how you can use the action to disable the Donations block:

    
    /**
     * Disable Jetpack's Donations block.
     */
    function jetpackcom_disable_donations_block() {
    	if ( ! class_exists( 'Jetpack_Gutenberg' ) ) {
    		return;
    	}
    	
    	Jetpack_Gutenberg::set_extension_unavailable(
    		'jetpack/donations',
    		'no_donations_for_you'
    	);
    }
    add_action( 'jetpack_register_gutenberg_extensions', 'jetpackcom_disable_donations_block', 99 );
    

    Does jetpack.com have a canonical list of the different blocks and modules, and their internal names, for when I need to disable different parts?

    You cannot find this on Jetpack.com, but you can check the “production” list in this file on your installation of Jetpack:
    https://plugins.trac.wordpress.org/browser/jetpack/tags/8.9.1/_inc/blocks/index.json

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to remove/disable individual blocks?’ is closed to new replies.