简体   繁体   English

如何删除仪表板中的wordpress文档菜单链接

[英]how to remove wordpress documentation menu link in dashboard

在此处输入图片说明

I want to customize my dashboard by removing WordPress icon and it's menu on the top bar but I have no idea of how it works because am not an expert in WordPress please help me我想通过删除 WordPress 图标和顶部栏上的菜单来自定义我的仪表板,但我不知道它是如何工作的,因为我不是 WordPress 专家,请帮助我

Create a new file in the WordPress wp-content/plugins/ folder named admin-bar.php then add the following plugin header:在 WordPress wp-content/plugins/ 文件夹中创建一个名为 admin-bar.php 的新文件,然后添加以下插件标题:

<?php
/*
Plugin Name: Admin Bar
Plugin URI: http://www.sitepoint.com/
Description: Modifies the WordPress admin bar
Version: 1.0
Author: Craig Buckler
Author URI: http://twitter.com/craigbuckler
License: MIT
*/

You can now activate this plugin in the WordPress administration panel.您现在可以在 WordPress 管理面板中激活此插件。 It won't do anything yet but you can make additions, save then refresh to view the updates.它不会执行任何操作,但您可以添加、保存然后刷新以查看更新。

you can remove existing items with the remove_node() method.您可以使用 remove_node() 方法删除现有项目。 For this, we need to create a new function named update_adminbar() which is passed an WP_Admin_Bar object ($wp_adminbar).为此,我们需要创建一个名为 update_adminbar() 的新函数,该函数传递一个 WP_Admin_Bar 对象 ($wp_adminbar)。 This function is called when the admin_bar_menu action hook is activated:这个函数在 admin_bar_menu 动作钩子被激活时被调用:

// update toolbar
function update_adminbar($wp_adminbar) {

  // remove unnecessary items
  $wp_adminbar->remove_node('wp-logo');
  $wp_adminbar->remove_node('customize');
  $wp_adminbar->remove_node('comments');

}

// admin_bar_menu hook
add_action('admin_bar_menu', 'update_adminbar', 999);

https://www.sitepoint.com/customize-wordpress-toolbar/ https://www.sitepoint.com/customize-wordpress-toolbar/

You can create a custom plugin and upload folder to your server with this one file in it.您可以创建一个自定义插件并将文件夹上传到您的服务器,其中包含这个文件。 Make sure to save the file as exact plugin name.确保将文件保存为确切的插件名称。 For example, "AdminBar.php"例如,“AdminBar.php”

<?php
/*
Plugin Name: AdminBar
Plugin URI: 
Description: Code to hide the admin bar for non-admins only.
Version: 1.0
Author: Name Here
Author URI:
*/

function hide_admin_bar_settings()
{
?>
    <style type="text/css">
        .show-admin-bar {
            display: none;
        }
    </style>
<?php
}
function disable_admin_bar()
{
    if(!current_user_can('administrator'))
    {
        add_filter( 'show_admin_bar', '__return_false' );
        add_action( 'admin_print_scripts-profile.php', 'hide_admin_bar_settings' );
    }
}
add_action('init', 'disable_admin_bar', 9);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM