我认为问题在于你对钩子和条件语句的选择。尝试初始化并删除!。
function themeblvd_disable_admin_bar() {
if( current_user_can(\'edit_posts\') )
add_filter(\'show_admin_bar\', \'__return_false\');
}
add_action( \'init\', \'themeblvd_disable_admin_bar\' );
看起来重定向的条件也错误
function themeblvd_redirect_admin(){
if ( current_user_can( \'edit_posts\' ) ){
wp_redirect( site_url() );
exit;
}
}
add_action( \'admin_init\', \'themeblvd_redirect_admin\' );
If these snippets work as tested please mark this answer as accepted and up vote using the arrows to the left. Thanks