Find My Blocks Plugin Shows All Blocks in Use on a WordPress Site

How do you know what blocks are in use on a WordPress site? I recently saw a tweet asking this question in regards to knowing whether it is safe to turn off a plugin. This seems like it could become a common question, especially for those who have hundreds or thousands of blog posts as well as those using WordPress as a CMS.

https://twitter.com/NickHamze/status/1253343502316064771

When looking at content in the editor, it isn’t immediately evident which blocks are in use. You can click on the block navigation at the top of the editor, but that will only show you the blocks in use on that particular page. If you have a lot of plugins installed and many pages of content to wade through, figuring out if it’s safe to remove a plugin can be a time-consuming process.

Fortunately, there is already a plugin that will give you a quick overview of where blocks are being used on your site. Find My Blocks is the one that was suggested to Nick Hamze in response to the question in his tweet. I had not heard of it before, so I took it for a test drive today.

Find My Blocks is basically a utility plugin that lists the blocks being used on your WordPress site, along with the posts/pages where they are in use. It includes core blocks and blocks from third-party plugins. The plugin’s settings also give the option to sort the block menu display alphabetically or by most/least popular.

Frontend developer Eddy Sims created Find My Blocks to solve one of his own problems and released it on WordPress.org in January.

“I was working on a site that required a few custom Gutenberg blocks,” Sims said. “After a week, updating became a hassle. I didn’t know where the blocks were used. Find My Blocks is a plugin I created to hopefully help someone else with this issue.” So far it has received several five-star reviews in the plugin directory.

“We’ve been using this plugin to help us figure out where we’ve used blocks on pages so we can deprecate them and replace them with shiny new blocks!” WordPress developer Tammy Lee said. “This plugin makes tracking down blocks really easy! I don’t want to think about how much time it would have taken us, otherwise.”

Find My Blocks is a plugin you may want to add to your favorites on WordPress.org for the next time you inherit a site that you didn’t build, or for cleaning out your own installed plugins.

9

9 responses to “Find My Blocks Plugin Shows All Blocks in Use on a WordPress Site”

  1. Great concept!

    This kind of tool is very much needed. Would be good to see as a CLI tool as well.

    Before using on larger sites, definitely be aware of the unbound request this is making here: https://plugins.trac.wordpress.org/browser/find-my-blocks/trunk/inc/register-route.php#L64

    This can have serious impact on larger sites, as it’s querying every single post in your site to create the response. This can be very slow and can even take sites down completely.

    Looking forward to see how this improves as I think this can be helpful for a lot of people!

  2. I published a single-file plugin that does the same thing, as a gist a few weeks back: https://gist.github.com/hughc/f69e46c3b624d9bb180595f5567fc654

    The basic premise is the same – query all posts, get post_content of each, and then use the parse_blocks() function to break that blob of commented html into its constituent blocks.

    I used it for a similar reason, I had gone a bit install-happy on several sets of custom blocks, including a few I’d written myself that I wanted to retire.

    Frustrating that there’s no means to do this out of the box with Gutenberg.

  3. Nice to know about this plugin. But can plugin authors please stop making top level admin menu items for your plugin. A plugin like this belongs as a sub menu item of the Tools menu.

    Btw plugin icon is great! Block meets map marker 🙂

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.