Nếu vì một lý do nào đó mà các bạn không muốn hiển thị logo WordPress trong phần quản trị (Admin Bar), hay menu Tools, Comments… thì đoạn code mà mình giới thiệu cho các bạn dưới đây sẽ giúp các bạn làm điều đó.

Gỡ bỏ các thành phần trong Dashboard của WordPress

Mặc định, Dashboard của WordPress có rất nhiều thành phần, trong đó bao gồm cả những thành phần không cần thiết.

Wordpress Dashboard - 1

Bấm vào hình để xem kích thước lớn hơn.

Để gỡ bỏ chúng, các bạn tạo một tập tin remove-dashboard-items.php có nội dung như sau và bỏ vào thư mục trong theme, ví dụ includes:

<?php
/**
 * Remove Menu Page
 */
function inithtml_remove_menu_pages() {
      remove_menu_page('tools.php');
      #remove_menu_page('plugins.php');
      #remove_menu_page('edit-comments.php');
      remove_submenu_page('index.php', 'update-core.php');
      #remove_submenu_page('themes.php', 'customize.php');
      #remove_submenu_page('themes.php', 'widgets.php');
}
add_action('admin_menu', 'inithtml_remove_menu_pages');

/**
 * Disable Auto-Saving
 */
function inithtml_disable_autosave(){
    wp_deregister_script('autosave');
}
add_action('wp_print_scripts', 'inithtml_disable_autosave');

/**
 * Remove Editor From Admin Appearance Menu
 */
function inithtml_remove_the_editor() {
      remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'inithtml_remove_the_editor', 1);

/**
 * Hide Help Tabs
 */
function inithtml_remove_help_tabs() {
    $screen = get_current_screen();
    $screen->remove_help_tabs();
}
add_action('admin_head', 'inithtml_remove_help_tabs');

/**
 * Remove menu tabs from the top toolbar
 */
function inithtml_config_admin_bar() {
      //call the global adminbar var
      global $wp_admin_bar;
      // hide the WP logo
      $wp_admin_bar->remove_menu('wp-logo');
      // hide link to the dashboard
      //$wp_admin_bar->remove_menu('dashboard');
      //hide links to WP
      //$wp_admin_bar->remove_menu('about');
      $wp_admin_bar->remove_menu('wporg');
      $wp_admin_bar->remove_menu('documentation');
      $wp_admin_bar->remove_menu('support-forums');
      $wp_admin_bar->remove_menu('feedback');
}
add_action('wp_before_admin_bar_render', 'inithtml_config_admin_bar');

/**
 * Hook for wp-admin logo
 */
function inithtml_login_logo_url() {
      return get_bloginfo('url');
}
add_filter('login_headerurl', 'inithtml_login_logo_url');

function inithtml_login_logo_url_title() {
      return get_bloginfo('name');
}
add_filter('login_headertitle', 'inithtml_login_logo_url_title');

Sau đó, ở functions.php, gọi lại tập tin vừa tạo.

include_once('includes/remove-dashboard-items.php');

Kết quả:

Wordpress Dashboard - 2

Bấm vào hình để xem kích thước lớn hơn.

Chúc các bạn thành công!