Skip to content

Instantly share code, notes, and snippets.

@Deaner666 Deaner666/functions.php
Last active Nov 13, 2015

What would you like to do?
Add a text area for details meta on a WooCommerce product category edit term page
add_action( 'product_cat_edit_form_fields', 'wpm_product_cat_edit_details_meta' );
* Add a details metabox to the Edit Product Category page.
* For adding a details metabox to the WordPress admin when
* editing an existing product category in WooCommerce.
* @param object $term The existing term object.
function wpm_product_cat_edit_details_meta( $term ) {
$product_cat_details = get_term_meta( $term->term_id, 'details', true );
if ( ! $product_cat_details ) {
$product_cat_details = '';
$settings = array( 'textarea_name' => 'wpm-product-cat-details' );
<tr class="form-field">
<th scope="row" valign="top"><label for="wpm-product-cat-details"><?php esc_html_e( 'Details', 'wpm' ); ?></label></th>
<?php wp_nonce_field( basename( __FILE__ ), 'wpm_product_cat_details_nonce' ); ?>
<?php wp_editor( wpm_sanitize_details( $product_cat_details ), 'product_cat_details', $settings ); ?>
<p class="description"><?php esc_html_e( 'Detailed category info to appear below the product list','wpm' ); ?></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.