Reusable Blocks accessible in WordPress admin area

Reusable Blocks are one of my favorite features in the new Gutenberg block editor. You can make content “reusable” and insert it into multiple pages.

We use this on GBC Law Group to list their services throughout the site. If they add a new service, it will automatically update everywhere at once.

What are reusable blocks?

Reusable blocks let you write content once and use it on multiple pages of your site. If you update the reusable block on any of those pages, it will automatically update everywhere it was used, keeping them in sync.

Reusable blocks are actually posts in a custom post type. When you create a reusable block, it adds those blocks to a new post in the wp_block post type.

To create a reusable block, start by adding any block to the page, then click “Add to Reusable Blocks”. Give your reusable block a title, then click “Save”. You can click “Edit” to add additional content.

When you insert a reusable block in a page, it references the reusable block’s post ID so it can always pull in the latest content. That’s how you can edit the reusable block once and it’s updated everywhere on your site.

On this website I have made a “Practice Areas” reusable block that contains multiple “Service” blocks – a custom block I built using Advanced Custom Fields.

When I’m editing another page, I can search the block list for my “Practice Areas” reusable block to insert it.

If you click the “Manage All Reusable Blocks” link, you can manage them like any other custom post type. But it would be even simpler if we included this link in the admin menu.

Add reusable blocks to admin menu

The following code will add “Reusable Blocks” to the WordPress admin menu. Add this to your theme’s functions.php file or a core functionality plugin:

/**
 * Reusable Blocks accessible in backend
 * @link https://www.billerickson.net/reusable-blocks-accessible-in-wordpress-admin-area
 *
 */
function be_reusable_blocks_admin_menu() {
    add_menu_page( 'Reusable Blocks', 'Reusable Blocks', 'edit_posts', 'edit.php?post_type=wp_block', '', 'dashicons-editor-table', 22 );
}
add_action( 'admin_menu', 'be_reusable_blocks_admin_menu' );

You can now click “Reusable Blocks” to see the full listing and edit them.

When you click on a reusable block, you get the familiar block editor for managing all the content within that reusable block.

WordPress Plugin

I’ve built a plugin you can install to add this functionality without editing any code.

Download and install Reusable Blocks UI.

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments are closed. Continue the conversation with me on Twitter: @billerickson

Comments

  1. Bridget Wessel says

    I had no idea this existed because I use the allowed_block_types filter on my sites and unless you have ‘core/block’ in the ‘allowed blocks array’ the Reusable menu options don’t show up. (I didn’t have ‘core/block’ in any of my ‘allowed blocks’.)

    Reusable blocks don’t seem to be very smart though. If you save a reusable block type that isn’t in the ‘allowed blocks array’ for the post type/template you are editing, it still shows up as a block that can be added to the page. Otherwise, I can see how they are useful for content repeated on different pages of a site.

  2. Cathy Tibbles says

    Thank you so much for all your tutorials and putting so much out there on your own time! You (and brian gardener) have helped my business for over 11 years. I couldn’t be more grateful for the gutenberg tutorials now that we’re learning a new system. And work flow.

    I was especially grateful for your post on your workflow and priorities for clients… things have changed so much I was considering page builders (apparently they don’t bloat sites any longer?), templates, custom blocks, block libraries, core plugin still – there are so many options and clients want so much. And now that Brian has left SP, I wonder about Genesis being the best option.

    Your post brought it back to whats important: an easy-to-use interface. And commented code so any wp developer can take over(which I consider one of the benefits of WP).

    Would you do a post on why you still hard code things? Do you see page builders taking a place in ‘development’? Are child themes still important? Thanks again for all you do!

    Cathy

  3. Bill Erickson says

    Thank you, it’s so great to hear how others have benefitted from the content and code I have shared.

    I should definitely write an article that dives deeper into our philsophy, process, and approach, but here’s a quick summary:

    The Gutenberg block editor provides an excellent foundation for building a custom “page builder” like experience specifically for your client’s needs. See my article on Building a theme with Gutenberg for more information on our design process and how we’re using core and custom blocks.

    I think page builders have expanded what’s possible for a non-technical website owner to implement on their own without the help of a developer. They are solving a well-defined need in the marketplace. With over one-third of the web running WordPress, only a small fraction of those websites have the budget to hire a designer and developer.

    WordPress core is trying to solve this problem with Gutenberg, so hopefully more people will be able to use WordPress itself to fully build their custom website and not depend on a plugin that replaces the content editing experience.

    The biggest downside to page builders is vendor lock-in. Once you have built a site with Elementor, Visual Composer, Beaver Builder, or any of the dozen other popular builders, you are pretty much stuck with it. If you ever want to change builders, or move to a native WordPress-based solution like we offer our clients, you’ll need to either manually update all your content or create a blank WordPress site and start from scratch.

    Building off of Gutenberg is different. Rather than a single company deciding the features and functionality of the builder, Gutenberg is built the WordPress way and easily extended by plugins. If you’re not developer and can’t built your own custom blocks (or even if you are and don’t want to spend the time building them), you can install plugins that provide the blocks for you.

    WordPress 5.3 will allow one-click installation of new blocks directly from Gutenberg. When you search for a block that you don’t have, it then searches the official block library and shows you options. You click one and it installs in the background, then is inserted in the content area so you can start typing.

    I think page builders will always have a place, but as WordPress continues to improve there will be less reason to need a page builder.

  4. Mark Howells-Mead says

    Terrific, thanks Bill. We’ve added this to our boilerplate code, so it’ll help all our clients’ and their authors!

  5. Robbert says

    I wonder about and would highly value your thoughts about the new block pattern functionality.

    Do you use it? Did it replace reusable blocks for you?

    • Bill Erickson says

      Reusable blocks and block patterns serve different purposes.

      – Reusable blocks allow you to feature the same content in multiple posts/pages, and any edits to one will automatically update all of the others.
      – Block patterns let you define a “template” of blocks that you can insert into a post/page and then modify it. There is no link between posts containing the same block pattern, so an edit in one post will not affect any others.