Hide a tab using unset( $tabs[‘custom_tab’] );
-
Hi, how can you hide a tab using unset( $tabs[‘custom_tab’] ); My snippet code is:
add_filter( 'woocommerce_product_tabs', 'remove_product_tabs', 98 ); function remove_product_tabs( $tabs ) { if ( ! is_user_logged_in() ) { unset( $tabs['custom_download'] ); // unset( $tabs['description'] ); } return $tabs; }
Unfortunately the code doesn’t work in any way. I absolutely need to have one tab visible only to logged in users. So far I have created the ACF field and it works, but I would like to have all the tabs in one place. custom tab is title my tab for example ‘downloads’. The plugin is great. Please Help.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Hide a tab using unset( $tabs[‘custom_tab’] );’ is closed to new replies.