Save custom field taxonomy in WooCommerce, Tags?

I added a custom field in taxonomie Tags, the plugin is WooCommerce. As it is now keep?

(saves custom field in the metadata tag)
July 2nd 19 at 14:26
2 answers
July 2nd 19 at 14:28
Solution
// The function to save the data
my_save_term_meta function( $term_id, $tt_id ) {

 if( isset( $_POST['my_key'] ) && " !== $_POST['my_key'] ) {
 $value = sanitize_title( $_POST['my_key'] );
 update_term_meta( $term_id, 'my_key', $value );
}

}
// Hakeem in the term
add_action( 'created_{taxonomy_name}', 'my_save_term_meta', 10, 2 );
// Hakeem in the edit screen of a term
add_action( 'edited_{taxonomy_name}', 'my_save_term_meta', 10, 2 );
Thank you. - jaycee commented on July 2nd 19 at 14:31
July 2nd 19 at 14:30
Download any plugin and see how it is implemented.

Find more questions by tags WordPress