Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Block the tab product filter in woocommerce settings › Reply To: Block the tab product filter in woocommerce settings
02/09/2020 at 14:09
#7012
Vladimir
Keymaster
Hi,
You were on the right way with
unset( $pages[‘product_filter’]);
The problem is the priority value. ‘Product filter’ plugin adds its tab via ‘woocommerce_settings_tabs_array’ filter with priority 50. So, in order to remove it you have to add the same filter with larger priority, at least 51. So try
add_filter('woocommerce_settings_tabs_array', 'change_wc_settings_tabs', 51);
function change_wc_settings_tabs( $pages ) {
$user = wp_get_current_user();
if ( in_array( 'your-role', $user->roles ) ) {
}
unset( $pages['product_filter']); // Product Filter
}