Learn in this tutorial how to hide the block patterns directory from WordPress editor using code.
WordPress 5.9 introduced quite a few new features, including the option to access the block pattern directory from the editor.
This feature allows that, while you are creating a page or post, when searching for blocks, you will not only see the ones you have installed, but also the ones that are in the block patterns directory.
This may seem like a good idea, but you may want to disable it on some clients’ websites.
Therefore, if you prefer that only the block patterns offered by a theme or plugin are used, it is best to disable the directory so that no new ones appear when searching.
Snippet to hide block directory patterns in WordPress editor
Add the following snippet in functions.php:
It’s as simple as that. Now the directory block patterns will no longer appear when you search from the block editor.
If you also want to hide the patterns that come in the WordPress core add the following:
The arrival of the block directory in the WordPress editor opens up many possibilities, but you’ll probably want to control some of them.
So, if you prefer not to have the WordPress directory block patterns displayed directly in the editor, now you know how to disable it. 😉
Any questions? I read you in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉