Support » Plugin: Custom Product Tabs for WooCommerce » How to add Product tab only visible to admins?

  • Resolved marko2317


    I need little help with your plugin.
    Anyway I would like to add product tab but only visible to admins. I need it to post some links inside for my self in future.

Viewing 1 replies (of 1 total)
  • Plugin Contributor yikesitskevin


    Hi @marko2317,

    I pushed an update on Friday that will allow this to work. Here are the details:

    I added a filter: yikes_woo_filter_all_product_tabs

    You can use it like this:

    add_filter( 'yikes_woo_filter_all_product_tabs', 'yikes_woo_add_tab_permissions', 10, 2 );
    function yikes_woo_add_tab_permissions( $tabs, $product ) {
    	if ( ! isset( $tabs['google-maps-embed'] ) ) {
    	if ( ! current_user_can( 'administrator' ) ) {
    		unset( $tabs['google-maps-embed'] );
    	return $tabs;

    In the above example, I’m looking specifically for a tab with the slug “google-maps-embed.” The slug is a hyphenated version of your tab, so if you have a tab named “My Admin Tab,” you can be pretty sure that the slug will be “my-admin-tab.” If you have some complicated tab name (with special characters), then just let me know first and I will tell you what the slug should be.

    I’m also restricting the tab to only administrators. I’m pretty sure this is what you’re looking for, but there’s a whole bunch of capabilities within WordPress so let me know if you want something more specific.

    Additionally, the filter is aware of the current WooCommerce product. In my example, I’m not looking for the product, I’m only saying “If we find the google maps embed tab, then don’t display it unless the user is an administrator.” However, if you need to scope this down (say for a specific product or group of products, etc.) then we can certainly accomplish that.


    P.S. Thanks for posting a support ticket here 🙂

    • This reply was modified 5 years, 2 months ago by yikesitskevin.
Viewing 1 replies (of 1 total)
  • The topic ‘How to add Product tab only visible to admins?’ is closed to new replies.