Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 其他用户wp主题选项显示I';我试图隐藏,但代码不起作用_Wordpress - Fatal编程技术网

Wordpress 其他用户wp主题选项显示I';我试图隐藏,但代码不起作用

Wordpress 其他用户wp主题选项显示I';我试图隐藏,但代码不起作用,wordpress,Wordpress,我想隐藏wp主题选项,除了其他用户,但它仍然是 显示 下面是我正在使用的代码 function twentyfifteen_remove_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } } add_action('after_setup_theme', 'twentyfifteen_remove_admin_bar'); /

我想隐藏wp主题选项,除了其他用户,但它仍然是 显示

下面是我正在使用的代码

function twentyfifteen_remove_admin_bar() 
{
if (!current_user_can('administrator') && !is_admin()) 
{
  show_admin_bar(false);
}
}

add_action('after_setup_theme', 'twentyfifteen_remove_admin_bar');

/*============= custom header code =============*/
试试这个:

add_theme_support( 'admin-bar', 'wpse45721_admin_bar_cb' );
function wpse45721_admin_bar_cb() {
    // What goes here is up to you
}
function hide_admin_bar( $show ) {
        if ( ! current_user_can( 'administrator' ) ) :
            return false;
        endif;
        return true;
    }
add_filter( 'show_admin_bar', 'hide_admin_bar' );

您可以尝试添加过滤器('show_admin_bar','uu return_false')请,任何人,如果得到解决方案,请帮助我是的,Jaydeep我也在尝试,但仍在展示。如果
fuctions.php
文件不起作用,请尝试:
add_action('set_current_user','cstrick_hide_admin_bar');函数cstricks_hide_admin_bar(){if(!current_user_can('edit_posts'){show_admin_bar(false);}}
return的第一个错误和第二个错误,不起作用。您使用的是哪个主题?我使用的是二十五个。您在哪里编写这些代码?可能是您的子主题不起作用。不,实际上我已经修改了整个主题以创建一个新主题,而且我正在使用一个主题。我的登录插件可能会出现问题