Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Need to give a user access to specific page on WooCommerce › Reply To: Need to give a user access to specific page on WooCommerce
24/05/2020 at 12:30
#6871
Vladimir
Keymaster
Hi,
Comment lines with tabs to leave, and uncomment lines with tabs you wish to hide/remove.
add_filter('woocommerce_settings_tabs_array', 'change_wc_settings_tabs', 30);
function change_wc_settings_tabs( $pages ) {
$user = wp_get_current_user();
if ( in_array( 'orders_manager', $user->roles ) ) {
//unset( $pages['general']); // General
//unset( $pages['products']); // Products
//unset( $pages['tax']); // Tax
unset( $pages['checkout']); // Payments
//unset( $pages['account']); // Accounts & Privacy
//unset( $pages['email']); // Emails
//unset( $pages['advanced']); // Advanced
}
return $pages;
}