php 从管理菜单中删除

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 从管理菜单中删除相关的知识,希望对你有一定的参考价值。


### Appearance / Edit, Plugins / Edit [wp-config.php]

<?php
	define( 'DISALLOW_FILE_EDIT', true );
?>

  

### Appearance / Customize [functions.php]

<?php
/**
* Remove entries from Appearance menu
*/
function remove_themes_options () {
	global $submenu;
	// Appearance Menu
	unset($submenu['themes.php'][5]); // Themes
	unset($submenu['themes.php'][6]); // Customizer
	unset($submenu['themes.php'][7]); // Widgets
	unset($submenu['themes.php'][10]); // Menus
	unset($submenu['themes.php'][15]); // Header
	unset($submenu['themes.php'][20]); // Background
}
add_action('admin_menu', 'remove_themes_options');   
?>



### Remove standard entries

<?php
/**
* Remove standard entries from Admin Menu
*/
function remove_menus(){
	remove_menu_page( 'index.php' ); //Dashboard
	remove_menu_page( 'jetpack' ); //Jetpack*
	remove_menu_page( 'edit.php' ); //Posts
	remove_menu_page( 'upload.php' ); //Media
	remove_menu_page( 'edit.php?post_type=page' ); //Pages
	remove_menu_page( 'edit-comments.php' ); //Comments
	remove_menu_page( 'themes.php' ); //Appearance
	remove_menu_page( 'plugins.php' ); //Plugins
	remove_menu_page( 'users.php' ); //Users
	remove_menu_page( 'tools.php' ); //Tools
	remove_menu_page( 'options-general.php' ); //Settings
}
add_action( 'admin_menu', 'remove_menus' );
?>

以上是关于php 从管理菜单中删除的主要内容,如果未能解决你的问题,请参考以下文章

php 从管理菜单中删除帖子,评论和工具

php 从管理菜单中删除未经审核的注释计数

php 从WordPress管理菜单中删除不需要的页面

WordPress从管理菜单中删除链接

从WordPress管理面板/仪表板删除菜单项

php 删除菜单页面管理员