Skip to content

Instantly share code, notes, and snippets.

@uptimizt
Created December 10, 2015 19:14
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 uptimizt/c9e9634136869592f744 to your computer and use it in GitHub Desktop.
Save uptimizt/c9e9634136869592f744 to your computer and use it in GitHub Desktop.
Сохраним значение поля через форму
//Сохранение данных поля uuid для категории продуктов
function mss_uuid_product_cat_form_edit($term_id){
if ( ! isset( $_POST['mss_uuid_product_cat'] ) || ! wp_verify_nonce( $_POST['mss_uuid_product_cat_nonce'], basename( __FILE__ ) ) )
return;
$mss_uuid_product_cat = $_POST['mss_uuid_product_cat'];
if(empty($mss_uuid_product_cat)) {
delete_term_meta( $term_id, 'uuid_product_category_mss' );
} else {
update_term_meta( $term_id, 'uuid_product_category_mss', $mss_uuid_product_cat );
}
}
add_action( 'edit_product_cat', 'mss_uuid_product_cat_form_edit' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment