Instantly share code, notes, and snippets.

Embed
What would you like to do?
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