Add a Patterns Link to the Admin Menu
Adds a "Patterns" item under Appearance that lists your synced patterns (reusable blocks), if your WordPress version does not show one already.
Opens WPIDE on
Code
add_action( 'admin_menu', function () {
global $submenu;
foreach ( (array) $submenu as $items ) {
foreach ( (array) $items as $item ) {
if ( isset( $item[2] ) && false !== strpos( $item[2], 'post_type=wp_block' ) ) {
return;
}
}
}
add_submenu_page( 'themes.php', 'Patterns', 'Patterns', 'edit_posts', 'edit.php?post_type=wp_block' );
}, 99 );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.