I’m using WooCommerce and I’d like to hide the "Linked Products" tab in the backend. I found a hook to add tabs (woocommerce_product_write_panel_tabs
) but I’m not sure if it’s also possible to hide certain tabs with this hook.
Thanks for any help!
![](https://www.manongdao.com/static/images/pcload.jpg)
Adding the following to the wp-admin.min.css should remove the linked products.
li.linked_product_options.linked_product_tab
{
display:none !important;
}
So I had the same issue. Woocommerce provides a filter (just as they do about everything else) that can handle this. The filter is 'woocommerce_product_data_tabs'.
function remove_linked_products($tabs){
unset($tabs['linked_product']);
return($tabs);
}
add_filter('woocommerce_product_data_tabs', 'remove_linked_products', 10, 1);
This will remove the linked products tab. You can also unset the other tabs using their array index. Below is a copy of the filter application from class-wc-meta-box-product-data.php.
$product_data_tabs = apply_filters( 'woocommerce_product_data_tabs', array(
'general' => array(
'label' => __( 'General', 'woocommerce' ),
'target' => 'general_product_data',
'class' => array( 'hide_if_grouped' ),
),
'inventory' => array(
'label' => __( 'Inventory', 'woocommerce' ),
'target' => 'inventory_product_data',
'class' => array( 'show_if_simple', 'show_if_variable', 'show_if_grouped' ),
),
'shipping' => array(
'label' => __( 'Shipping', 'woocommerce' ),
'target' => 'shipping_product_data',
'class' => array( 'hide_if_virtual', 'hide_if_grouped', 'hide_if_external' ),
),
'linked_product' => array(
'label' => __( 'Linked Products', 'woocommerce' ),
'target' => 'linked_product_data',
'class' => array(),
),
'attribute' => array(
'label' => __( 'Attributes', 'woocommerce' ),
'target' => 'product_attributes',
'class' => array(),
),
'variations' => array(
'label' => __( 'Variations', 'woocommerce' ),
'target' => 'variable_product_options',
'class' => array( 'variations_tab', 'show_if_variable' ),
),
'advanced' => array(
'label' => __( 'Advanced', 'woocommerce' ),
'target' => 'advanced_product_data',
'class' => array(),
)
));
So just substitute the unset($tabs['linked_product'] with whichever tab you want to remove from the backend.