Remove WordPress 6.5 block template menu item

WordPress three one hundred and twenty-nine Reading mode

WordPress 6.5 adds a new block template menu item in the appearance menu. This block template can combine different blocks into a new block template for easy reuse.

If you don't use the block editor, and you want to hide it, you can use the following code.

 Remove WordPress 6.5 block template menu item - Picture 1

Add the code to the current topic function template functions.php.

 add_action( 'admin_menu', 'zm_remove_patterns_menu' ); function zm_remove_patterns_menu() { remove_submenu_page( 'themes.php', 'edit.php?post_type=wp_block' ); }

The above code, through the hook provided by WordPress add_action , mount the function to 'admin_menu' Action, execute remove_submenu_page afferent 'themes.php' (identifier of the parent menu) and 'edit.php? post_type=wp_block' (Identifier of submenu) parameter to remove the submenu from the management menu.

By analogy, if you want to hide other menu items, use the browser developer tool to view the menu items, replace and modify the relevant parameters in the above code with the labels of the parent and child menu items respectively.

 Remove WordPress 6.5 block template menu item - Picture 2

Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!

 weinxin
My Wechat
Copyright Notice
Please indicate the source and link of the original article reprinted on this site. Thank you for your cooperation!
five hundred and ninety-eight million eight hundred and forty-five thousand and six
 
 Robin
five hundred and ninety-eight million eight hundred and forty-five thousand and six
Comments three    Visitors two    Author one
    •  Kevin
      Kevin one

      So far, I haven't seen any difference between 6.5 and the previous one...

        •  Robin
          Robin

          @ Kevin Only by skillfully using the block editor can you see the difference

        •  Blue Lotus
          Blue Lotus three

          Does wp6.5 speed have obvious advantages?

         anonymous

        Comment

        Anonymous netizens
         :?:  :razz:  :sad:  :evil:  :!:  :smile:  :oops:  :grin:  :eek:  :shock:  :???:  :cool:  :lol:  :mad:  :twisted:  :roll:  :wink:  :idea:  :arrow:  :neutral:  :cry:  :mrgreen:

        Drag the slider to complete validation