How to Add Reusable Blocks to Admin Menu

Manuel campos -

Reusable blocks allow you to create and store sections of content that can be inserted into multiple posts or pages.

By default, WordPress does not provide a way to access and edit reusable blocks outside of the individual post-editing screen.

This code snippet adds a new menu item in the WordPress admin sidebar called “Reusable Blocks,” which allows you to edit reusable blocks in a similar way to how you would edit posts or pages.

function my_reusable_blocks_admin_menu() {
	add_menu_page( 'Reusable Blocks', 'Reusable Blocks', 'edit_posts', 'edit.php?post_type=wp_block', '', 'dashicons-editor-table', 22 );
}
add_action( 'admin_menu', 'my_reusable_blocks_admin_menu' );

Keep in mind that if you make changes to a reusable block through this menu, the updates will be applied to all instances of the block within your posts and pages.”

JM
About me
I am José Manuel. I am writing about things I know and things that I am learning about WordPress. I hope you find the content of this blog useful.
Linktree

You might also Like...