- PHP
- WordPress
The Situation
One of two items I do not like with the WordPress Block Editor (Gutenburg) is how to manage reusable blocks once you have created a pattern of blocks into a Pattern or Reusable Block.
Once you actually find the setting – exposed in the “dot menu” in the top right of the Gutenburg panel:
and then selecting the “Manage patterns” link in the “Tools” section, as seen above.
My Solution
I like to add the following code to my theme functions.php
file, which will create a sub-menu item on the “Tools” menu linking directly to “Patterns” panel in the WordPress Admin:
add_action('admin_menu', 'add_custom_link_into_pattern_manager');
function add_custom_link_into_pattern_manager() {
global $submenu;
$permalink = admin_url().'edit.php?post_type=wp_block';
$submenu['themes.php'][] = array(
'Block Pattern Manager',
'manage_options',
$permalink
);
}
The output in the admin menu will be similar to this: