Discover in this tutorial how to unregister Genesis Blocks using code.
Since a few versions of WordPress, you have the option to hide the blocks that you do not want to be displayed in the editor
You can do this by clicking on the three dots at the top left and selecting: Tools > Block Manager.

But this does not prevent the blocks from being loaded and accessible from the manager for other users.
That’s why in a previous tutorial I explained how to unregister the native blocks of the WordPress editor. In this case, you are going to see how to achieve the same thing but with Genesis Blocks.
Steps to unregister blocks from Genesis Blocks
1. Create a file unregister-blocks.js
Insert this snippet into a new file named unregister-header.js inside the /lib/js/ folder:
To see this and another 965 code snippets of this website, login or subscribe here.
If the /js/ folder does not exist, create it. Or if you prefer to place it in another path in the theme, you can do that, just make sure to change it in the next step as well.
This script uses the unregisterBlockType
function to unregister the blocks you are interested in.
In this case, you are unregistering the column block (global and individual) and the spacer block. This way you avoid confusion with the native blocks of this type. Although if you prefer you could leave these and remove the native ones.
In any case, at the end of the tutorial you will find a list with all the Genesis Blocks so you can customize the snippet to your liking.
2. Enqueue the file unregister-blocks.js
Now, paste the following block at the end of the functions.php file of your WordPress theme:
To see this and another 965 code snippets of this website, login or subscribe here.
With these lines you get the theme to load the unregister_blocks.js
file.
Genesis Blocks blocks
Here you have the list with all the blocks included in Genesis Blocks:
- genesis-blocks/gb-accordion
- genesis-blocks/gb-columns
- genesis-blocks/gb-columns
- genesis-blocks/gb-button
- genesis-blocks/gb-cta
- genesis-blocks/gb-container
- genesis-blocks/gb-devices
- genesis-blocks/gb-drop-cap
- genesis-blocks/newsletter
- genesis-blocks/gb-layouts
- genesis-blocks/gb-notice
- genesis-blocks/gb-post-grid
- genesis-blocks/gb-pricing
- genesis-blocks/gb-pricing-table
- genesis-blocks/gb-pricing-table-price
- genesis-blocks/gb-pricing-table-features
- genesis-blocks/gb-pricing-table-title
- genesis-blocks/gb-pricing-table-subtitle
- genesis-blocks/gb-pricing-table-button
- genesis-blocks/gb-profile-box
- genesis-blocks/gb-sharing
- genesis-blocks/gb-spacer
- genesis-blocks/gb-testimonial
With this information you can add all the blocks you want to remove to the snippet in step 1.
Conclusions
Would you prefer to stop loading Genesis Blocks that you won’t use? Or that you don’t want your client to see? Well, now you know how to unregister them with a little bit of code.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂