给大家介绍删除后台标题中的WordPress后缀的方法,希望对需要的朋友有所帮助!
WordPress后台标题(title)默认后缀显示-WordPress,如果想隐藏这个后缀,可以将下面代码添加到当前主题functions.php中,即可删除这个后缀:
去除后台标题中的“- WordPress”
// 去除后台标题中的“—— WordPress”
add_filter(‘admin_title’, ‘zm_custom_admin_title’, 10, 2);
function zm_custom_admin_title($admin_title, $title){
return $title.’ ‹ ‘.get_bloginfo(‘name’😉;
}
去除登录标题中的“- WordPress”
// 隐藏后台标题中的“WordPress”
add_filter(‘login_title’, ‘zm_custom_login_title’, 10, 2);
function zm_custom_login_title($login_title, $title){
return $title.’ ‹ ‘.get_bloginfo(‘name’😉;
}
附:隐藏后台其它明显与WordPress相关的字样和图标
隐藏后台左上角WordPress标志
// 隐藏左上角WordPress标志
function hidden_admin_bar_remove() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu(‘wp-logo’😉;
}
add_action(‘wp_before_admin_bar_render’, ‘hidden_admin_bar_remove’, 0);
屏蔽后台页脚WordPress版本信息
// 屏蔽后台页脚WordPress版本信息
function change_footer_admin () {return ”;}
add_filter(‘admin_footer_text’, ‘change_footer_admin’, 9999);
function change_footer_version() {return ”;}
add_filter( ‘update_footer’, ‘change_footer_version’, 9999);
移除WordPress仪表盘中的项目
function remove_dashboard_meta() {
remove_meta_box( ‘dashboard_incoming_links’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_plugins’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_primary’, ‘dashboard’, ‘side’ );
remove_meta_box( ‘dashboard_secondary’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_quick_press’, ‘dashboard’, ‘side’ );
remove_meta_box( ‘dashboard_recent_drafts’, ‘dashboard’, ‘side’ );
remove_meta_box( ‘dashboard_recent_comments’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_right_now’, ‘dashboard’, ‘normal’ );
remove_meta_box( ‘dashboard_activity’, ‘dashboard’, ‘normal’😉;//since 3.8
}
add_action( ‘admin_init’, ‘remove_dashboard_meta’ );
以上就是如何删除后台标题中的WordPress后缀的详细内容,更多请关注网站的其它相关文章!