How to Remove Core Blocks in WordPress?

Being a WordPress developer and learning more about Gutenberg, I have noticed some of the instances where we need to hide the core blocks that we don’t want to provide access to the editorial team of our clients. The reason behind it is really clear that we don’t want the editorial team to get confused on the unnecessary core blocks as those blocks are not needed by a specific business website. Sometimes, those unnecessary core blocks left accessible for editorial team can accidentally break the layout of the client’s business website as well.

Hence, it is a wise choice as a WordPress developer, to determine the business needs of your client and based on that evaluate the number of core blocks you will need based on the designs and remove access to all the other core blocks.

Today, we’ll be learning about this unique customization skill to remove core WordPress blocks just to provide an enhanced user experience to your client with their new business website. Before proceeding to implementation, let me help you understand the benefits of removing the core blocks.

Benefits

Why you might want to remove core WordPress blocks?

I have curated a list for you based on my experience so far:

  • Simplifies the editorial experience – This is essential for your client’s editorial team to focus on content creation rather than dealing with frequent issues.
  • Keep the editor performant – Removing core WordPress blocks that are not needed based on the use-case will provide you with a performant block editor.

Let me know in comments, if you have any other benefits that comes to your mind. Now, let’s proceed with the implementation part on how to remove the core blocks in WordPress.

How to Remove Core WordPress blocks?

Practically, there are 2 ways using which you can remove core WordPress blocks.

  • Using a plugin (Beginner Friendly)
  • Programmatically (For WordPress Developers)

Option 1: How to remove core blocks using WordPress Plugin?

First of all, this is a beginner friendly method to remove core blocks in WordPress using a third-party WordPress plugin. You can use this method when you don’t want to hire a WordPress Developer to fulfil your business needs and your website is just a hobby project. Then, you are good to go with this method by installing a WordPress plugin.

Step 1: Install and Activate Plugin

Go to Admin > Plugin > Add New and search for plugin with name Gutenberg Block Manager or Disable Gutenberg Blocks – Block Manager and then click Install and then Activate.

Step 2: Navigate to Settings

After activating any of these plugins, you can simply go to Admin > Settings and look for a new submenu page – it can be named “Block Manager” or “Disable Blocks” or “Manage Blocks” or “Remove Blocks” and then click on that to see the plugin settings.

Step 3: Choose Your Blocks

Now, as you are on the plugin settings page, select the blocks you would like to remove or disable.

Step 4: Save Changes

Always remember to save your changes. Once done, the selected blocks will no longer appear in the block selection module while editing posts or pages or any custom post type.

Note: Any content already created using these blocks will still be visible on your site. This process only removes them as options from the editor.

Option 2: How to remove core blocks programmatically?

This method is more technical and advanced for removing the core blocks in WordPress. You will need to have technical expertise and understanding of the WordPress files and how WordPress works in general.

For those who are comfortable working with code, there’s a way to remove WordPress blocks directly through functions.php in your theme or via a custom WordPress plugin:

Step 1: Access the file

You will need access to functions.php in your theme or any relevant file from your custom WordPress plugin.

Step 2: Add this Code

You need to add the following code to the file you have access to as mentioned in the previous step. Feel free to add filter based on the Code Design you are working with whether it is PHP namespacing or Singleton class.

function mg_disable_gutenberg_blocks($allowed_blocks) {
    unset($allowed_blocks['core/blockName']); // replace 'blockName' with the block's name
    return $allowed_blocks;
}
add_filter('allowed_block_types', 'mg_disable_gutenberg_blocks');

Remember to replace blockName with the name of the block you wish to disable.

Step 3: Save Changes

Remember to save the file to reflect the changes. The targeted blocks will now be removed from your editor.

Conclusion

To conclude, we have learnt two different ways to remove core blocks for any WordPress website. You can provide a streamlined editorial experience for your clients. However, out of those 2 methods, I would recommend to implement removing the core blocks programmatically as it ensure that your client’s team doesn’t accidentally change the disabled core block selection. So, go ahead and provide the best and unique experience to your clients.

As always, I’m here to help and guide you on your WordPress journey. Stay tuned for more practical tips and tutorials, and please share your thoughts or questions in the comments.

Loved this article? Feel free to share with your friends and colleagues using Twitter or any of your preferred social media.
Mehul Gohil
Mehul Gohil

Mehul Gohil is a Full Stack WordPress developer and an active member of the local WordPress community. For the last 10+ years, he has been developing custom WordPress plugins, custom WordPress themes, third-party API integrations, performance optimization, and custom WordPress websites tailored to the client's business needs and goals.

Articles: 123

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *