Online WordPress

How do I create a reusable block in WordPress?

reusable block in WordPress
Building blocks: the new WordPress editor has hidden power

Last Updated on

If – like ours – your site is based on WordPress, you’re probably still getting to grips with the new editor.

Codenamed Gutenberg, the editor is no longer one long document that you thrash with headlines, text, images and all the other elements that make up a post.

Instead, the page is now broken into ‘blocks’, with each block being a discreet chunk of content, whether that be a heading, a paragraph of text, a table or an embedded video.

At first, it’s pretty disorienting and confusing. But once you get to grips with the new blocks and the new way of doing things, you’ll realise it’s a lot more powerful and cleaner than what went before.

One great new feature is the ability to create reusable blocks of content. Let’s say, for example, you have a video with a piece of text that you regularly embed in your posts – you can now save that chunk of content as a reusable block in WordPress and insert it into your posts or pages with a couple of clicks.

Here’s how to do it.

Creating a resuable block

Reusable blocks are really handy if a lot of your posts are templated. For example, I use WordPress to create the online football programmes for Lewes FC. Each matchday programme is a separate post, but they will contain many elements that are used in every programme: an audio interview with the manager, a Spotify playlist of the music we play in the stadium, a table displaying the teams.

Each of these elements can be saved as a reusable blocks, so that when I come to create a new programme, I can simply choose which elements I want to fill the programme with – changing the running order, if necessary.

A key point to note here is that resuable blocks can contain multiple blocks. So, for example, the interview with the manager is formed of a headline, a photo, a short passage of text and the embedded audio, which is four separate blocks. I can save all those together as one reusable block, so that I don’t have to rebuild that element every time I create a new programme.

To create a reusable block, you simply click and drag to select all the blocks you wish to include, then click on the three dots that appear at the top of the selection and select “Add to reusable blocks”.

reusable block in WordPress

You’ll be asked to give the block a name and then save it.

How to insert a reusable block in WordPress posts

So how do you place these saved blocks into your new posts? It’s dead easy.

In the post editor, press the + button to insert a new block in the normal way. In the pop-up menu that appears, scroll down until you find ‘reusable’, and you should find a list of all the reusable blocks you’ve got saved, as in our screenshot below.

reusable block in WordPress

Once you’ve selected it, the content will be injected into your post.

Converting reusable blocks to regular blocks – and why you might want to do this

Reusable blocks aren’t set in stone once you’ve saved them. You can click on a reusable block to edit it, and the changes you make will be replicated in every instance of the reusable block used on your site.

But that might not be the behaviour you seek. In the example above, for instance, I might use the same headline, photo and blurb for the manager’s interview in every programme, but the audio file embedded with each interview will change every week. If I update the reusable block with the latest interview, it will place that new interview in all the old programmes. That’s obviously not what I want.

To get around this, you can convert the resuable blocks back into regular blocks once they’ve been inserted into your post.

Click on the three dots at the top of the block and select ‘convert to regular block’.

reusable block in WordPress

This will put the three elements – the header, the photo and the text – onto the page as ordinary blocks and then I can insert the new audio beneath it. It means I only need to update one small part of that section every time I create a new programme, which is a real time-saver.

There’s another good reason to convert reusable blocks back into regular blocks – reusables don’t appear in the post navigation that you get when you click the i button at the top of posts. They also don’t appear in the automatic summaries of posts that WordPress can now create, letting you basically insert a contents at the top of long posts and let readers jump to the relevant section.

I’ve only just started using reusable blocks, but I can already feel they’re going to become an indispensable part of my workflow on multiple sites.

Update: My colleague and pro WordPress wrangler, David Artiss, chips in with the following advice on reusable blocks:

“If you click on the three vertical dots in the top right, you’ll find a menu option named “Manage All Reusable Blocks” – you can use that to view and edit all of your reusable blocks.

So, what you can do is to create a post with a number of blocks, then copy all and then head to that management area, click on “Add” and paste in as a new reusable block. As a further tip, you can use that three-dots menu to quickly select the entire post, as there’s an option titled “Copy All Content”.”

Now read this: How can I create a plugin for WordPress?

About the author

Barry Collins

Barry has scribbled about tech for almost 20 years for The Sunday Times, PC Pro, WebUser, Which? and many others. He was once Deputy Editor of Mail Online and remains in therapy to this day. Email Barry at barry@bigtechquestion.com.

Add Comment

Click here to post a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: