欢迎光临
我们一直在努力

怎样删除wordpress后台默认管理菜单功能选项

对于一些企业化的定制用户,我们很有必须要对wordpress主题的默认后台菜单选项进行一些修改或是删减比如,如果有新闻的添加改成新闻,那如果对于小工具或是页面功能使用不到的我们需要做一个隐藏或是删减的调整,那我们就需要用到以下的代码功能来满意我们的小需求。

下面代码添加到wordpress主题的funtion.php文件内,不同的名称代表后台不同的菜单选项链接。

'index.php', // Dashboard仪盘表
      'edit.php?post_type=custom_type_one', // Custom type one
      'edit.php?post_type=custom_type_two', // Custom type two
      'edit.php?post_type=custom_type_three', // Custom type three
      'edit.php?post_type=custom_type_four', // Custom type four
      'edit.php?post_type=custom_type_five', // Custom type five
      'separator1', // First separator
      'edit.php?post_type=page', // Pages页面
      'edit.php', // Posts文章
      'upload.php', // Media多媒体
      'link-manager.php', // Links链接
      'edit-comments.php', // Comments评论
      'separator2', // Second separator
      'themes.php', // Appearance主题
      'plugins.php', // Plugins插件
      'users.php', // Users用户
      'tools.php', // Tools工具
      'options-general.php', // Settings设置
      'separator-last', // Last separator

这里是我们真正要用到的wordpress后台选项菜单移除代码,我们需要用到 remove_menu_page(‘*’);对wordpress后台选项做调整。

/*remove_menu_page_wp3.1*/
function yg_remove_menu_page() {
  remove_menu_page('themes.php');  // 移除 "外观"
  remove_menu_page('plugins.php'); // 移除 "插件"
  remove_menu_page('tools.php');   // 移除 "工具"
}
add_action( 'admin_menu', 'yg_remove_menu_page' );

除了主菜单选项外我们还可以对二次菜单进行调整,具体的代码样式如下。

/*remove_submenu_page_wp3.1*/
function yg_remove_submenu_page() {
  remove_submenu_page( 'index.php', 'update-core.php' ); //移除“控制面板”下的“更新”
}
if ( is_admin() ) {
  add_action('admin_init','yg_remove_submenu_page');
}

 

赞(0) 打赏
未经允许不得转载:WORDPRESS大侠 » 怎样删除wordpress后台默认管理菜单功能选项

评论 抢沙发

评论前必须登录!

 

更好的WordPress主题

支持快讯、专题、百度收录推送、人机验证、多级分类筛选器,适用于垂直站点、科技博客、个人站,扁平化设计、简洁白色、超多功能配置、会员中心、直达链接、文章图片弹窗、自动缩略图等...

联系我们联系我们

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

登录

找回密码

注册