WordPress去除后台标题中的后缀!

WordPress后台标题(title)默认后缀显示-WordPress,如果想隐藏这个后缀,可以将下面代码添加到当前主题functions.php中,即可删除这个后缀:

1.去除后台标题中的“- WordPress

  1. // 去除后台标题中的“—— WordPress”
  2. add_filter(‘admin_title’, ‘zm_custom_admin_title’, 10, 2);
  3. function zm_custom_admin_title($admin_title, $title){
  4. return $title.‘ ‹ ‘.get_bloginfo(‘name’);
  5. }

2.去除登录标题中的“- WordPress”PS:隐藏后台其它明显与WordPress相关的字样和图标

  1. // 隐藏后台标题中的“WordPress”
  2. add_filter(‘login_title’, ‘zm_custom_login_title’, 10, 2);
  3. function zm_custom_login_title($login_title, $title){
  4. return $title.‘ ‹ ‘.get_bloginfo(‘name’);
  5. }

3.隐藏后台左上角WordPress标志

  1. // 隐藏左上角WordPress标志
  2. function hidden_admin_bar_remove() {
  3. global $wp_admin_bar;
  4. $wp_admin_bar->remove_menu(‘wp-logo’);
  5. }
  6. add_action(‘wp_before_admin_bar_render’, ‘hidden_admin_bar_remove’, 0);

4.屏蔽后台页脚WordPress版本信息

  1. // 屏蔽后台页脚WordPress版本信息
  2. function change_footer_admin () {return ;}
  3. add_filter(‘admin_footer_text’, ‘change_footer_admin’, 9999);
  4. function change_footer_version() {return ;}
  5. add_filter( ‘update_footer’, ‘change_footer_version’, 9999);

5.移除WordPress仪表盘中的项目

  1. function remove_dashboard_meta() {
  2. remove_meta_box( ‘dashboard_incoming_links’, ‘dashboard’, ‘normal’ );
  3. remove_meta_box( ‘dashboard_plugins’, ‘dashboard’, ‘normal’ );
  4. remove_meta_box( ‘dashboard_primary’, ‘dashboard’, ‘side’ );
  5. remove_meta_box( ‘dashboard_secondary’, ‘dashboard’, ‘normal’ );
  6. remove_meta_box( ‘dashboard_quick_press’, ‘dashboard’, ‘side’ );
  7. remove_meta_box( ‘dashboard_recent_drafts’, ‘dashboard’, ‘side’ );
  8. remove_meta_box( ‘dashboard_recent_comments’, ‘dashboard’, ‘normal’ );
  9. remove_meta_box( ‘dashboard_right_now’, ‘dashboard’, ‘normal’ );
  10. remove_meta_box( ‘dashboard_activity’, ‘dashboard’, ‘normal’);//since 3.8
  11. }
  12. add_action( ‘admin_init’, ‘remove_dashboard_meta’ );

发表评论