Hide tabs on woocommerce product editor for user role





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I need help how to hide custom product data tabs (created by plugins) for custom user role on product page editor (see image).



enter image description here



I think it suppose to be done by modifying its CSS and apply it on functions.php



Already try and play with the below code and add the element in it, but not working.



// Remove Product Data Tabs Options on product page editor
add_filter('woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );

function hide_wc_product_tabs($tabs) {

if (!current_user_can('yith_vendor')) { // replace role ID with your own
return $tabs;
}

//what code should I implement here

return $tabs;
}


Any help appreciate. thank you










share|improve this question























  • Which plugin is used for custom product data tabs? So I can clearly understand and will help you.

    – Tanmay Patel
    Apr 2 at 9:17











  • what @Karun said below solved the problem but not all, the tab created by plugin should be hide is Epeken and the additional extra tab created by the theme.

    – jasaweb
    Apr 2 at 9:27











  • Can you please let me know theme name or give me website URL. So I can check it.

    – Tanmay Patel
    Apr 2 at 9:35











  • Here is the theme link themeforest.net/item/…

    – jasaweb
    Apr 2 at 11:00


















1















I need help how to hide custom product data tabs (created by plugins) for custom user role on product page editor (see image).



enter image description here



I think it suppose to be done by modifying its CSS and apply it on functions.php



Already try and play with the below code and add the element in it, but not working.



// Remove Product Data Tabs Options on product page editor
add_filter('woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );

function hide_wc_product_tabs($tabs) {

if (!current_user_can('yith_vendor')) { // replace role ID with your own
return $tabs;
}

//what code should I implement here

return $tabs;
}


Any help appreciate. thank you










share|improve this question























  • Which plugin is used for custom product data tabs? So I can clearly understand and will help you.

    – Tanmay Patel
    Apr 2 at 9:17











  • what @Karun said below solved the problem but not all, the tab created by plugin should be hide is Epeken and the additional extra tab created by the theme.

    – jasaweb
    Apr 2 at 9:27











  • Can you please let me know theme name or give me website URL. So I can check it.

    – Tanmay Patel
    Apr 2 at 9:35











  • Here is the theme link themeforest.net/item/…

    – jasaweb
    Apr 2 at 11:00














1












1








1








I need help how to hide custom product data tabs (created by plugins) for custom user role on product page editor (see image).



enter image description here



I think it suppose to be done by modifying its CSS and apply it on functions.php



Already try and play with the below code and add the element in it, but not working.



// Remove Product Data Tabs Options on product page editor
add_filter('woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );

function hide_wc_product_tabs($tabs) {

if (!current_user_can('yith_vendor')) { // replace role ID with your own
return $tabs;
}

//what code should I implement here

return $tabs;
}


Any help appreciate. thank you










share|improve this question














I need help how to hide custom product data tabs (created by plugins) for custom user role on product page editor (see image).



enter image description here



I think it suppose to be done by modifying its CSS and apply it on functions.php



Already try and play with the below code and add the element in it, but not working.



// Remove Product Data Tabs Options on product page editor
add_filter('woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );

function hide_wc_product_tabs($tabs) {

if (!current_user_can('yith_vendor')) { // replace role ID with your own
return $tabs;
}

//what code should I implement here

return $tabs;
}


Any help appreciate. thank you







woocommerce tabs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 2 at 8:56









jasawebjasaweb

85




85













  • Which plugin is used for custom product data tabs? So I can clearly understand and will help you.

    – Tanmay Patel
    Apr 2 at 9:17











  • what @Karun said below solved the problem but not all, the tab created by plugin should be hide is Epeken and the additional extra tab created by the theme.

    – jasaweb
    Apr 2 at 9:27











  • Can you please let me know theme name or give me website URL. So I can check it.

    – Tanmay Patel
    Apr 2 at 9:35











  • Here is the theme link themeforest.net/item/…

    – jasaweb
    Apr 2 at 11:00



















  • Which plugin is used for custom product data tabs? So I can clearly understand and will help you.

    – Tanmay Patel
    Apr 2 at 9:17











  • what @Karun said below solved the problem but not all, the tab created by plugin should be hide is Epeken and the additional extra tab created by the theme.

    – jasaweb
    Apr 2 at 9:27











  • Can you please let me know theme name or give me website URL. So I can check it.

    – Tanmay Patel
    Apr 2 at 9:35











  • Here is the theme link themeforest.net/item/…

    – jasaweb
    Apr 2 at 11:00

















Which plugin is used for custom product data tabs? So I can clearly understand and will help you.

– Tanmay Patel
Apr 2 at 9:17





Which plugin is used for custom product data tabs? So I can clearly understand and will help you.

– Tanmay Patel
Apr 2 at 9:17













what @Karun said below solved the problem but not all, the tab created by plugin should be hide is Epeken and the additional extra tab created by the theme.

– jasaweb
Apr 2 at 9:27





what @Karun said below solved the problem but not all, the tab created by plugin should be hide is Epeken and the additional extra tab created by the theme.

– jasaweb
Apr 2 at 9:27













Can you please let me know theme name or give me website URL. So I can check it.

– Tanmay Patel
Apr 2 at 9:35





Can you please let me know theme name or give me website URL. So I can check it.

– Tanmay Patel
Apr 2 at 9:35













Here is the theme link themeforest.net/item/…

– jasaweb
Apr 2 at 11:00





Here is the theme link themeforest.net/item/…

– jasaweb
Apr 2 at 11:00










2 Answers
2






active

oldest

votes


















1














The $tabs will return an array. Before the line return $tabs; you should check the key in the array and unset it. You can use var_dump to check what the array contains if you're unsure of the key name.






share|improve this answer
























  • thanks, it works but I only got one key name from the tabs, how to get the other tabs key name?

    – jasaweb
    Apr 2 at 9:23













  • $tabs should return all the available keys. Try increasing the priority value on add_filter and keep on debugging using var_dump

    – Karun
    Apr 2 at 9:26











  • still no luck after increasing the priority value. any other method?

    – jasaweb
    Apr 2 at 10:04



















1














So using your code as reference, you could do something like:



function hide_wc_product_tabs( $tabs ) {
if ( ! current_user_can( 'yith_vendor' ) ) {
return $tabs;
}

unset( $tabs['inventory'] ); // Removes the inventory tab.

return $tabs;
}

add_filter( 'woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );


These are the default WooCommerce product tabs:



Array ( [0] => general [1] => inventory [2] => shipping [3] => linked_product [4] => attribute [5] => variations [6] => advanced )


Hope it helps!






share|improve this answer
























  • I get it, but what I need to hide additional custom tabs created by specific plugins. I think it suppose to be done by modifying its CSS and apply it in the code.

    – jasaweb
    Apr 2 at 9:07













  • @jasaweb You can do what @Karun suggested in his answer, do a var_dump($tabs) so you can see what is the key for each tab, and then unset what you don't need.

    – dboris
    Apr 2 at 9:10











  • @jasaweb So you can add this line before that unset: var_dump( array_keys( $tabs ) ); It will print the "name" for all the tabs that are available, then you can unset the ones you want to.

    – Tiago Hillebrandt
    Apr 2 at 9:10













  • ok going to try

    – jasaweb
    Apr 2 at 9:12












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "110"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f333204%2fhide-tabs-on-woocommerce-product-editor-for-user-role%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The $tabs will return an array. Before the line return $tabs; you should check the key in the array and unset it. You can use var_dump to check what the array contains if you're unsure of the key name.






share|improve this answer
























  • thanks, it works but I only got one key name from the tabs, how to get the other tabs key name?

    – jasaweb
    Apr 2 at 9:23













  • $tabs should return all the available keys. Try increasing the priority value on add_filter and keep on debugging using var_dump

    – Karun
    Apr 2 at 9:26











  • still no luck after increasing the priority value. any other method?

    – jasaweb
    Apr 2 at 10:04
















1














The $tabs will return an array. Before the line return $tabs; you should check the key in the array and unset it. You can use var_dump to check what the array contains if you're unsure of the key name.






share|improve this answer
























  • thanks, it works but I only got one key name from the tabs, how to get the other tabs key name?

    – jasaweb
    Apr 2 at 9:23













  • $tabs should return all the available keys. Try increasing the priority value on add_filter and keep on debugging using var_dump

    – Karun
    Apr 2 at 9:26











  • still no luck after increasing the priority value. any other method?

    – jasaweb
    Apr 2 at 10:04














1












1








1







The $tabs will return an array. Before the line return $tabs; you should check the key in the array and unset it. You can use var_dump to check what the array contains if you're unsure of the key name.






share|improve this answer













The $tabs will return an array. Before the line return $tabs; you should check the key in the array and unset it. You can use var_dump to check what the array contains if you're unsure of the key name.







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 2 at 9:02









KarunKarun

983721




983721













  • thanks, it works but I only got one key name from the tabs, how to get the other tabs key name?

    – jasaweb
    Apr 2 at 9:23













  • $tabs should return all the available keys. Try increasing the priority value on add_filter and keep on debugging using var_dump

    – Karun
    Apr 2 at 9:26











  • still no luck after increasing the priority value. any other method?

    – jasaweb
    Apr 2 at 10:04



















  • thanks, it works but I only got one key name from the tabs, how to get the other tabs key name?

    – jasaweb
    Apr 2 at 9:23













  • $tabs should return all the available keys. Try increasing the priority value on add_filter and keep on debugging using var_dump

    – Karun
    Apr 2 at 9:26











  • still no luck after increasing the priority value. any other method?

    – jasaweb
    Apr 2 at 10:04

















thanks, it works but I only got one key name from the tabs, how to get the other tabs key name?

– jasaweb
Apr 2 at 9:23







thanks, it works but I only got one key name from the tabs, how to get the other tabs key name?

– jasaweb
Apr 2 at 9:23















$tabs should return all the available keys. Try increasing the priority value on add_filter and keep on debugging using var_dump

– Karun
Apr 2 at 9:26





$tabs should return all the available keys. Try increasing the priority value on add_filter and keep on debugging using var_dump

– Karun
Apr 2 at 9:26













still no luck after increasing the priority value. any other method?

– jasaweb
Apr 2 at 10:04





still no luck after increasing the priority value. any other method?

– jasaweb
Apr 2 at 10:04













1














So using your code as reference, you could do something like:



function hide_wc_product_tabs( $tabs ) {
if ( ! current_user_can( 'yith_vendor' ) ) {
return $tabs;
}

unset( $tabs['inventory'] ); // Removes the inventory tab.

return $tabs;
}

add_filter( 'woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );


These are the default WooCommerce product tabs:



Array ( [0] => general [1] => inventory [2] => shipping [3] => linked_product [4] => attribute [5] => variations [6] => advanced )


Hope it helps!






share|improve this answer
























  • I get it, but what I need to hide additional custom tabs created by specific plugins. I think it suppose to be done by modifying its CSS and apply it in the code.

    – jasaweb
    Apr 2 at 9:07













  • @jasaweb You can do what @Karun suggested in his answer, do a var_dump($tabs) so you can see what is the key for each tab, and then unset what you don't need.

    – dboris
    Apr 2 at 9:10











  • @jasaweb So you can add this line before that unset: var_dump( array_keys( $tabs ) ); It will print the "name" for all the tabs that are available, then you can unset the ones you want to.

    – Tiago Hillebrandt
    Apr 2 at 9:10













  • ok going to try

    – jasaweb
    Apr 2 at 9:12
















1














So using your code as reference, you could do something like:



function hide_wc_product_tabs( $tabs ) {
if ( ! current_user_can( 'yith_vendor' ) ) {
return $tabs;
}

unset( $tabs['inventory'] ); // Removes the inventory tab.

return $tabs;
}

add_filter( 'woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );


These are the default WooCommerce product tabs:



Array ( [0] => general [1] => inventory [2] => shipping [3] => linked_product [4] => attribute [5] => variations [6] => advanced )


Hope it helps!






share|improve this answer
























  • I get it, but what I need to hide additional custom tabs created by specific plugins. I think it suppose to be done by modifying its CSS and apply it in the code.

    – jasaweb
    Apr 2 at 9:07













  • @jasaweb You can do what @Karun suggested in his answer, do a var_dump($tabs) so you can see what is the key for each tab, and then unset what you don't need.

    – dboris
    Apr 2 at 9:10











  • @jasaweb So you can add this line before that unset: var_dump( array_keys( $tabs ) ); It will print the "name" for all the tabs that are available, then you can unset the ones you want to.

    – Tiago Hillebrandt
    Apr 2 at 9:10













  • ok going to try

    – jasaweb
    Apr 2 at 9:12














1












1








1







So using your code as reference, you could do something like:



function hide_wc_product_tabs( $tabs ) {
if ( ! current_user_can( 'yith_vendor' ) ) {
return $tabs;
}

unset( $tabs['inventory'] ); // Removes the inventory tab.

return $tabs;
}

add_filter( 'woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );


These are the default WooCommerce product tabs:



Array ( [0] => general [1] => inventory [2] => shipping [3] => linked_product [4] => attribute [5] => variations [6] => advanced )


Hope it helps!






share|improve this answer













So using your code as reference, you could do something like:



function hide_wc_product_tabs( $tabs ) {
if ( ! current_user_can( 'yith_vendor' ) ) {
return $tabs;
}

unset( $tabs['inventory'] ); // Removes the inventory tab.

return $tabs;
}

add_filter( 'woocommerce_product_data_tabs' , 'hide_wc_product_tabs' );


These are the default WooCommerce product tabs:



Array ( [0] => general [1] => inventory [2] => shipping [3] => linked_product [4] => attribute [5] => variations [6] => advanced )


Hope it helps!







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 2 at 9:04









Tiago HillebrandtTiago Hillebrandt

1043




1043













  • I get it, but what I need to hide additional custom tabs created by specific plugins. I think it suppose to be done by modifying its CSS and apply it in the code.

    – jasaweb
    Apr 2 at 9:07













  • @jasaweb You can do what @Karun suggested in his answer, do a var_dump($tabs) so you can see what is the key for each tab, and then unset what you don't need.

    – dboris
    Apr 2 at 9:10











  • @jasaweb So you can add this line before that unset: var_dump( array_keys( $tabs ) ); It will print the "name" for all the tabs that are available, then you can unset the ones you want to.

    – Tiago Hillebrandt
    Apr 2 at 9:10













  • ok going to try

    – jasaweb
    Apr 2 at 9:12



















  • I get it, but what I need to hide additional custom tabs created by specific plugins. I think it suppose to be done by modifying its CSS and apply it in the code.

    – jasaweb
    Apr 2 at 9:07













  • @jasaweb You can do what @Karun suggested in his answer, do a var_dump($tabs) so you can see what is the key for each tab, and then unset what you don't need.

    – dboris
    Apr 2 at 9:10











  • @jasaweb So you can add this line before that unset: var_dump( array_keys( $tabs ) ); It will print the "name" for all the tabs that are available, then you can unset the ones you want to.

    – Tiago Hillebrandt
    Apr 2 at 9:10













  • ok going to try

    – jasaweb
    Apr 2 at 9:12

















I get it, but what I need to hide additional custom tabs created by specific plugins. I think it suppose to be done by modifying its CSS and apply it in the code.

– jasaweb
Apr 2 at 9:07







I get it, but what I need to hide additional custom tabs created by specific plugins. I think it suppose to be done by modifying its CSS and apply it in the code.

– jasaweb
Apr 2 at 9:07















@jasaweb You can do what @Karun suggested in his answer, do a var_dump($tabs) so you can see what is the key for each tab, and then unset what you don't need.

– dboris
Apr 2 at 9:10





@jasaweb You can do what @Karun suggested in his answer, do a var_dump($tabs) so you can see what is the key for each tab, and then unset what you don't need.

– dboris
Apr 2 at 9:10













@jasaweb So you can add this line before that unset: var_dump( array_keys( $tabs ) ); It will print the "name" for all the tabs that are available, then you can unset the ones you want to.

– Tiago Hillebrandt
Apr 2 at 9:10







@jasaweb So you can add this line before that unset: var_dump( array_keys( $tabs ) ); It will print the "name" for all the tabs that are available, then you can unset the ones you want to.

– Tiago Hillebrandt
Apr 2 at 9:10















ok going to try

– jasaweb
Apr 2 at 9:12





ok going to try

– jasaweb
Apr 2 at 9:12


















draft saved

draft discarded




















































Thanks for contributing an answer to WordPress Development Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fwordpress.stackexchange.com%2fquestions%2f333204%2fhide-tabs-on-woocommerce-product-editor-for-user-role%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

Puebla de Zaragoza

Musa