This file contains hidden or 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 | |
// Save extra taxonomy fields callback function | |
add_action( 'edited_product_cat', 'save_taxonomy_custom_meta', 10, 2 ); | |
add_action( 'create_product_cat', 'save_taxonomy_custom_meta', 10, 2 ); | |
function save_taxonomy_custom_meta( $term_id ) { | |
if ( isset( $_POST['term_meta'] ) ) { | |
$t_id = $term_id; | |
$term_meta = get_option( "taxonomy_$t_id" ); |
This file contains hidden or 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 | |
// Edit term page | |
add_action( 'product_cat_edit_form_fields', 'wpm_taxonomy_edit_meta_field', 10, 2 ); | |
function wpm_taxonomy_edit_meta_field($term) { | |
// put the term ID into a variable | |
$t_id = $term->term_id; | |
This file contains hidden or 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 term page | |
add_action( 'product_cat_add_form_fields', 'wpm_taxonomy_add_new_meta_field', 10, 2 ); | |
function wpm_taxonomy_add_new_meta_field() { | |
// this will add the custom meta field to the add new term page | |
?> | |
<div class="form-field"> | |
<label for="term_meta[custom_term_meta]"><?php _e( 'Details', 'wpm' ); ?></label> |
NewerOlder