Last active
March 28, 2019 12:06
-
-
Save UltimateWoo/84e335c7d19e29d481a3bd726419b21c to your computer and use it in GitHub Desktop.
Adding custom product tabs in WooCommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add a custom tab to WooCommerce products | |
* | |
* @param (array) $tabs - Registered tabs | |
* @return (array) $tabs - Updated array of tabs | |
* | |
* @author UltimateWoo <www.ultimatewoo.com> | |
*/ | |
function uw_custom_product_tab( $tabs ) { | |
global $post; | |
$tabs['uw_custom_product_tab'] = array( | |
'title' => 'Test Tab', | |
'priority' => 50, | |
'callback' => function( $key, $tab ) { | |
echo "Our custom test tab's content, added via PHP!"; | |
} | |
); | |
return $tabs; | |
} | |
add_action( 'woocommerce_product_tabs', 'uw_custom_product_tab' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment