Skip to content

Instantly share code, notes, and snippets.

@web-hat
Last active March 27, 2017 18:11
Show Gist options
  • Save web-hat/019099abb3e6b1d65df0b2758b60608a to your computer and use it in GitHub Desktop.
Save web-hat/019099abb3e6b1d65df0b2758b60608a to your computer and use it in GitHub Desktop.
WooCommerce Product Category custom field
<?php
add_action('edited_product_cat', 'wh_save_taxonomy_custom_meta', 10, 1);
add_action('create_product_cat', 'wh_save_taxonomy_custom_meta', 10, 1);
// Save extra taxonomy fields callback function.
function wh_save_taxonomy_custom_meta($term_id) {
$wh_meta_title = filter_input(INPUT_POST, 'wh_meta_title');
$wh_meta_desc = filter_input(INPUT_POST, 'wh_meta_desc');
update_term_meta($term_id, 'wh_meta_title', $wh_meta_title);
update_term_meta($term_id, 'wh_meta_desc', $wh_meta_desc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment