首页 > 解决方案 > 我想为除管理员之外的所有用户隐藏自定义 yith pos 选项卡。我怎样才能做到这一点?

问题描述

我想为除管理员之外的所有用户隐藏自定义 yith pos 选项卡。我怎样才能做到这一点?

截屏 :

在此处输入图像描述

我试过了,但没有用

add_filter( 'yith_pos_panel_settings_tabs_array',  'filter_yith_pos_panel_settings_tabs_array', 200, 1 );
function filter_yith_pos_panel_settings_tabs_array( $tabs_array ) {
    // Only for "shipping_manager" user role
    if( current_user_can( 'YITH_POS_Manager' ) ) {
        // Remove some specific tabs
        unset( $tabs_array['customization'], 
    }
    
    return $tabs_array;
}

标签: phpwoocommerce

解决方案


推荐阅读