If you work with WordPress for any length of time, you’ll know that sometimes a plugin you’re using gets abandoned or removed from the repository. When this happens, it’s good to replace it with another, up-to-date plugin.
This happened to me with WP Block Gallery and the site in question happened to use three different block plugins. I needed a quick way to determine which blocks were used on which pages, and wanted to create a system I could use next time this happened, so I did an experiment.
I chose a variety of block plugins that had been updated recently, a lot of installations and good reviews. I installed these 10 (listed in alphabetical order).
- Essential Blocks
- Gutenberg Blocks and Template Library by Otter
- Kadence Blocks
- PublishPress Blocks
- Ultimate Addons for Gutenberg
- Ultimate Blocks
Just a note that there are other block plugins available; this post isn’t about which block plugins are better than others, rather I chose a variety to make the experiment more robust.
After I installed and activated the plugins, I had a colleague add different blocks from different plugins to five test pages that she created.
The answers that we’re looking for are found in the database. There are different ways to access the database depending on your website host. In your Flywheel dashboard, go to Advanced and Manage Database. In cPanel, go to phpMyAdmin. Once you access the database, look for your posts table.
After reviewing the records in my posts table, I saw that each plugin prefixed their blocks with
wp:. Most block plugins used names that were easily recognizable:
- CoBlocks –
- Essential Blocks –
- Generate Blocks –
- Gutenberg Blocks and Template Library by Otter –
- Gutentor –
- Kadence Blocks –
- PublishPress Blocks –
- Stackable –
- Ultimate Addons for Gutenberg –
- Ultimate Blocks –
The name of the block comes after the block library. For example:
I created the following query for the the posts table. If you want to include custom post types, add those inside the brackets with
SELECT post_title, post_type, post_content
WHERE post_type IN ('page', 'post')
AND post_status = 'publish'
AND post_content LIKE '%wp:%';
If you’re not familiar with SQL, use the search function to look for:
- The title, the type (post, page or your custom post type) and the content
- From the posts table (make sure to use your database prefix)
- Where it’s a page, post or your custom post type (not an image or attachment, etc.)
- And it’s a published page or post (not a revision)
- And the post content has at least one block
If you’re able to export the results to CSV, it will be easier to navigate the results. Here we can see that on the page named TEST 2, my colleague used:
- Advanced Columns from ThemeIsle blocks
- Call to Action, Text and Button Group from Stackable
- GIF from CoBlocks
Now that I’ve identified the blocks and pages, I can swap the blocks out for others and remove the abandoned plugin.
Have questions or comments? Let’s chat on Twitter.