In recent times blocks are used to add content to posts in WordPress. They are an integral part of the whole content creation experience in WordPress. While WordPress provides dozens of built-in core blocks, we can create our own blocks to meet our requirements. In this article, we are going to take a look at how to hide a block in the Inserter in WordPress.

but before that, I need to make it clear that in this article, we are talking about hiding a block from the Inserter, not disabling it entirely. It means that in case there are previous instances of the block in any of our pages, they will remain intact. In case we disable the blocks, all the instances of the block would also be deleted. I have discussed about disabling blocks in this article. With that out of the way, we see in what scenario would we need to hide a block in Inserter.

When do we need to hide a block in the Inserter in WordPress

In what scenario, would we want to disable blocks in the Inserter? Off the top of my head, a couple of scenarios come to mind–

Using Patterns or Template Parts

The recent iterations of WordPress have ventured into Full Site Editing and with that, Patterns and Template Parts have become an important part of the workflow. So, consider that you created a header and footer template parts and used the navigation block in them. Now, you don’t plan to use the navigation block anywhere else on the site. You can just go ahead and hide it from the inserter. This way, if the navigation block is added using the header or footer template parts, it will show up, but not as an individual block in the inserter.

Improve Efficiency

WordPress comes bundled with a ton of built-in blocks. Not all of these blocks will be needed in your workflow. For instance, not every blogger is going to use the code  block. So, it makes sense to just hide the block from the Inserter and prevent it from showing up. This helps clean up the inserter and even improve the efficiency of your website.

So, now that we’ve seen the potential use cases for hiding blocks in the inserter, let’s see how to do it.

How to Hide Blocks in the Inserter

So, we can use two methods to hide the blocks in the Inserter. We can either disable the blocks from the Dashboard itself or if you are a familiar with code, we can also use JavaScript bu that’s beyond the scope of this article and we’ll discuss it at a later time. So, let’s get started!

We can toggle the visibility of any blocks that we do not require from the WordPress Dashboard itself. To achieve this, follow the following steps–

  1.  Click the three dots at the top right corner of your Edit screen.
  2. Scroll all the way down the menu and click on “Preferences”.
    Click on Preferences
  3. In the modal that pops up, click on “Blocks” tab at the left. You’ll be seeing the section “Manage Block Visibility”.
  4. Here, you can toggle the visibility of any block you want. The already present instances of the blocks will remain but it won’t be possible to add more instances through the Inserter.

Conclusion

So, that was it! We saw in this article how to hide blocks in the Inserter in WordPress. Hiding redundant blocks helps clean up the Inserter and even has performance benefits. While it can be done programmatically as well, it deserves its own article.

Hope you learnt something new in this article. If you would like to learn more cool tips and tricks of WordPress, head over to my blog where I share my two-cents in WordPress Development. Also, in case you are looking for an epic WordPress Theme for your next project, head over to my WordPress Themes library. You’ll be able to find some amazing WordPress Themes perfect for your next big project.

Meet the Author

Divjot Singh

Divjot is an experienced WordPress developer and technical writer with more than a decade of experience in WordPress Development. Whenever he's not creating amazing WordPress experiences, he can be found on the road with his bike.

Leave a Reply

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