lzb/show_admin_menu
Takes the Lazy Blocks item out of the admin sidebar, which is what handing a finished site to a client without inviting them to edit its blocks takes.
The default is true. Returning false calls remove_menu_page( 'edit.php?post_type=lazyblocks' ) on admin_menu at priority 12. That hides the link and nothing else. The screens stay reachable by URL and the edit_lazyblocks capability still governs who may open them, so this is tidiness rather than a permission boundary.
Attributes
| Name | Type | Description |
|---|---|---|
$show | Boolean | show the admin menu item, true by default |
Usage
function my_lzb_show_admin_menu( $show ) {
// Only the developer account keeps the menu item.
return current_user_can( 'manage_options' ) && 'dev@example.com' === wp_get_current_user()->user_email;
}
add_filter( 'lzb/show_admin_menu', 'my_lzb_show_admin_menu' );// Hide it from everyone.
add_filter( 'lzb/show_admin_menu', '__return_false' );Register the filter before admin_menu runs at priority 12, which any plugin or functions.php load does. Only the administrator role has edit_lazyblocks out of the box, so editors, authors and contributors never see the menu item in the first place and this filter is aimed at administrators. To actually keep somebody out of the block builder, remove that capability from their role instead of hiding the link.