Categories
Hacks WordPress

Gutenberg: Add a reusable blocks menu

I love Gutenberg. I also love using reusable blocks too. What I don’t love, though, is having to go into an existing post just to access my reusable blocks list.

So how about a quick and easy method to add them to your admin menu?

What do you get now?

Just for clarity, let’s just confirm how it works now. To access your list of reusable blocks, you have to…

  1. Edit a post
  2. Click the 3 vertical dots menu in the top right-hand corner of the editor
  3. Select “Manage all reusable blocks”

The resulting list is fantastic – you can fully manage them from here, including adding, editing and deleting. You can also import as JSON files as well.

However, there’s 2 issues here…

  1. It’s not obvious where this is
  2. You have to go into an existing post to access it (or bookmark the URL)

The Solution

Just stick the code in your theme’s functions.php file…

/** * Add a menu for the block editor */ function add_block_menu() { add_menu_page( 'Reusable Blocks', 'Reusable Blocks', 'manage_options', 'edit.php?post_type=wp_block', '', 'dashicons-editor-table', 22 ); } add_action( 'admin_menu', 'add_block_menu' );

The result is a new option in your left-hand menu, allowing you to access all your block goodness in one easy-to-find location…

Talk to me!

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