//移除左上角Wlog
function annointed_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu(‘wp-logo’);
}
add_action(‘wp_before_admin_bar_render’, ‘annointed_admin_bar_remove’, 0);
//移除Wordpress后台“感谢使用wordpress创作”
function my_admin_footer_text(){
return “”;
}
function my_update_footer()
{
return “”;
}
add_filter( ‘admin_footer_text’, ‘my_admin_footer_text’, 10 );
add_filter( ‘update_footer’, ‘my_update_footer’, 50 );
//修改登录页面logo
function custom_loginlogo() {
echo ”;
}
add_action(‘login_head’, ‘custom_loginlogo’);
//禁用后台登录页语言切换
add_filter( ‘login_display_language_dropdown’, ‘__return_false’ );
//让wordpress首页隐藏某一分类的文章
function excludeCat($query) {
if ( $query->is_home ) {
$query->set(‘cat’, ‘-20,-21,-22,-23,-32’ );
}
return $query;
}
add_filter(‘pre_get_posts’, ‘excludeCat’);
//设置登录查看网站内容
add_action( ‘template_redirect’, ‘ashuwp_show_only_login’, 0 );
function ashuwp_show_only_login(){
//判断登录
if( !is_user_logged_in() ){
auth_redirect(); //跳转到登录页面
exit();
}
}