Title: Hide Custom Tabs
Last modified: March 19, 2019

---

# Hide Custom Tabs

 *  Resolved [yakiimo](https://wordpress.org/support/users/albertof92/)
 * (@albertof92)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/hide-custom-tabs/)
 * Hello,
    Is there a way to hide a custom tab to an unregistered (guest) user? 
   Ty in advance!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11329953)
 * Hi [@albertof92](https://wordpress.org/support/users/albertof92/),
 * Yes! We have a filter function for that. Are you familiar with adding PHP filter
   functions to your site?
 * The following snippet will hide tabs called Additional Tab 1 and Additional Tab
   2 from your site. If you have a tab called e.g. Product Information, change `
   additional-tab-1` to `product-information`.
 *     ```
       add_filter( 'yikes_woo_filter_all_product_tabs', 'yikes_woo_hide_tabs_from_non_logged_in_users', 10, 2 );
   
       function yikes_woo_hide_tabs_from_non_logged_in_users( $tabs, $product ) {
   
       	if ( isset( $tabs['additional-tab-1'] ) && ! is_user_logged_in() ) {
       		unset( $tabs['additional-tab-1'] );
       	}
   
       	if ( isset( $tabs['additional-tab-2'] ) && ! is_user_logged_in() ) {
       		unset( $tabs['additional-tab-2'] );
       	}
   
       	return $tabs;
       }
       ```
   
 * Let me know if you need any help adding the snippet to your site.
 * Thank you,
    Kevin.
 *  Thread Starter [yakiimo](https://wordpress.org/support/users/albertof92/)
 * (@albertof92)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11342265)
 * Thanks for the reply, but seems like it’s not working.
    I created two custom 
   tabs, called Manuals and Softwares (from the Admin panel menu, so they are saved
   as a template); then, I added the code.
 * This is the code I inserted into the Theme’s custom CSS:
 * add_filter( ‘yikes_woo_filter_all_product_tabs’, ‘yikes_woo_hide_tabs_from_non_logged_in_users’,
   10, 2 );
 * function yikes_woo_hide_tabs_from_non_logged_in_users( $tabs, $product ) {
 *  if ( isset( $tabs[‘manuals’] ) && ! is_user_logged_in() ) {
    unset( $tabs[‘manuals’]);}
 *  if ( isset( $tabs[‘softwares’] ) && ! is_user_logged_in() ) {
    unset( $tabs[‘
   softwares’] ); }
 *  return $tabs;
    }
 * I can still see the tabs both as logged in (as should be) and logged out (shouldnt
   be).
    Any help? 🙁
 * Thank you again
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11343634)
 * Hi [@albertof92](https://wordpress.org/support/users/albertof92/),
 * Where did you add this code? I just tested this and it’s working for me. Here
   are some screenshots to show how it’s set up.
 * Saved tabs called Manuals & Softwares: [https://imgur.com/a/JACdT1U](https://imgur.com/a/JACdT1U)
 * Applying those two saved tabs to my product: [https://imgur.com/a/l2ElsPc](https://imgur.com/a/l2ElsPc)
 * And the code:
 *     ```
       add_filter( 'yikes_woo_filter_all_product_tabs', 'yikes_woo_hide_tabs_from_non_logged_in_users', 10, 2 );
   
       function yikes_woo_hide_tabs_from_non_logged_in_users( $tabs, $product ) {
   
       	if ( isset( $tabs['manuals'] ) && ! is_user_logged_in() ) {
       		unset( $tabs['manuals'] );
       	}
   
       	if ( isset( $tabs['softwares'] ) && ! is_user_logged_in() ) {
       		unset( $tabs['softwares'] );
       	}
   
       	return $tabs;
       }
       ```
   
 * When I am logged in I see these two tabs. When I open the page in incognito (
   i.e. logged out), I do not see the tabs.
 * Let me know if I’ve done anything differently to you.
 * Cheers,
    Kevin.
 *  Thread Starter [yakiimo](https://wordpress.org/support/users/albertof92/)
 * (@albertof92)
 * [7 years ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11351123)
 * Thank you for your prompt reply.
    I put the exact same code in the Custom CSS
   of my Bridge WordPress Theme, Custom Tabs are the same too. You can see the three
   pictures here (Theme Custom CSS, Custom Tabs, Tab View from LOG OUT): [https://imgur.com/a/PVkhyH8](https://imgur.com/a/PVkhyH8)
 * I can still see the tabs both from logged in and logged out 🙁
 * PS
    On the last picture you can see another custom tab (datasheet) but that should
   be visible to everyone, just I case you asked.
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [7 years ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11352351)
 * Hi [@albertof92](https://wordpress.org/support/users/albertof92/),
 * The problem is that this code is not CSS – it’s PHP. You need to add this code
   to your child theme’s `functions.php` file. If you’re not using a child theme,
   you could add it to your theme’s `functions.php` file or use a plugin like [My Custom Functions](https://wordpress.org/plugins/my-custom-functions/).
 * Hope that fixes it.
 * Cheers,
    Kevin.
 *  Thread Starter [yakiimo](https://wordpress.org/support/users/albertof92/)
 * (@albertof92)
 * [7 years ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11355205)
 * It works!
    Thank you very much, sorry if I didn’t exactly know about the difference!
   You learn something new every day.
 * Thanks again!
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [7 years ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11357049)
 * All good! Glad you got it working! 🙂

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Hide Custom Tabs’ is closed to new replies.

 * ![](https://ps.w.org/yikes-inc-easy-custom-woocommerce-product-tabs/assets/icon-
   256x256.png?rev=1558461)
 * [Custom Product Tabs for WooCommerce](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Active Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/hide-custom-tabs/#post-11357049)
 * Status: resolved