Disable menu in wordpress admin

Today I found very usefull function, witch let to remove (disable) menu in wordpress admin. Its remove_menu_page( $menu_slug ) and remove_submenu_page( $menu_slug, $submenu_slug ).

It’s easy to remove menu entries and it is not necessary anymore to edit wordpress core. This is a small example, where I removed the entries to the comments and the submenu-page discussion.

Copy this example to function.php, and you will see, that it work.

function remove_admin_menu () {
	
		remove_menu_page( 'edit-comments.php' );
		remove_menu_page( 'link-manager.php' );
		remove_menu_page( 'tools.php' );
		remove_submenu_page( 'options-general.php', 'options-discussion.php' );
	
}
add_action( 'admin_menu', 'remove_admin_menu' );

This function will disable comments, links, ant tools menu.

Leave a Reply

Your email address will not be published. Required fields are marked *