Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7004
    8pdesign
    Participant

    Hi, 
    We try to block the tabs of woocommerce like this method : https://www.role-editor.com/forums/topic/need-to-give-a-user-access-to-specific-page-on-woocommerce/ but we have the plugin Product Filter for WooCommerce from XforWooCommerce and it add on tab named “Product filters” with this link /wp-admin/admin.php?page=wc-settings&tab=product_filter.
    We try to unset like this : unset( $pages[‘product_filter’]); but doesn’t work, do you have any idea to block this.
    Thanks

    #7006
    Vladimir
    Keymaster

    Hi,

    I need access to the “Product Filter” plugin in order to test this. Share its .zip via DropBox or similar with support [at-sign] role-editor.com
    I use such products for the investigation purpose only and install at the local development environment.

    #7008
    8pdesign
    Participant

    Hi,

    You can find the zip for the plugin there: [removed link]

    Thanks

    #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
    }
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.