Created
April 24, 2020 09:56
-
-
Save dartiss/cb56778196725d7961fb3efb40c3bc37 to your computer and use it in GitHub Desktop.
WordPress script to add reusable blocks to the WP Admin menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.