Last active
March 27, 2017 18:11
-
-
Save web-hat/019099abb3e6b1d65df0b2758b60608a to your computer and use it in GitHub Desktop.
WooCommerce Product Category custom field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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