Skip to content

Instantly share code, notes, and snippets.

@Deaner666
Created November 13, 2015 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Deaner666/e8400edd1726fa3652fd to your computer and use it in GitHub Desktop.
Save Deaner666/e8400edd1726fa3652fd to your computer and use it in GitHub Desktop.
Register "details" meta field on WooCommerce product_cat terms
<?php
add_action( 'init', 'wpm_product_cat_register_meta' );
/**
* Register details product_cat meta.
*
* Register the details metabox for WooCommerce product categories.
*
*/
function wpm_product_cat_register_meta() {
register_meta( 'term', 'details', 'wpm_sanitize_details' );
}
/**
* Sanitize the details custom meta field.
*
* @param string $details The existing details field.
* @return string The sanitized details field
*/
function wpm_sanitize_details( $details ) {
return wp_kses_post( $details );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment