Skip to content

Instantly share code, notes, and snippets.

@dartiss
Created April 24, 2020 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dartiss/cb56778196725d7961fb3efb40c3bc37 to your computer and use it in GitHub Desktop.
Save dartiss/cb56778196725d7961fb3efb40c3bc37 to your computer and use it in GitHub Desktop.
WordPress script to add reusable blocks to the WP Admin menu
/**
* 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' );
@dartiss
Copy link
Author

dartiss commented Apr 24, 2020

Having to go into an existing post to access the reusable blocks menu is a pain (imo). This small script, added to your functions.php will add a top level menu to admin so that you can access them directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment