Skip to content

Instantly share code, notes, and snippets.

@khikrama
Forked from woogists/wc-add-custom-tab.php
Created July 7, 2019 21:05
Show Gist options
  • Save khikrama/d652be3dd603b3ac1151c450f8791313 to your computer and use it in GitHub Desktop.
Save khikrama/d652be3dd603b3ac1151c450f8791313 to your computer and use it in GitHub Desktop.
[Frontend Snippets][Editing product data tabs] Add a custom tab
/**
* Add a custom product data tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
function woo_new_product_tab_content() {
// The new tab content
echo '<h2>New Product Tab</h2>';
echo '<p>Here\'s your new product tab.</p>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment