How to add extra fields to taxonomy in wordpress?
- by admin
- 0
To add extra fields to taxonomy or category use below hook:
add_action(‘categoryname’_add_form_fields,’function_name’);
Sample:
function add_extra_fields() {
?>
<div class=”form-field”>
<input type=”text” name=”term_meta[wh_meta_title]” id=”term_meta[wh_meta_title]”>
</div>
<?php
}
function edit_extra_fields($term) {
}
function save_extra_fields($term) {
}
add_action(‘product_cat_add_form_fields’, ‘add_extra_fields’); // For ‘product_cat’
add_action(‘product_cat_edit_form_fields’, ‘edit_extra_fields’);
add_action(‘edited_product_cat’, ‘save_extra_fields’);
To add extra fields to taxonomy or category use below hook: add_action(‘categoryname’_add_form_fields,’function_name’); Sample: function add_extra_fields() { ?> <div class=”form-field”> <input type=”text” name=”term_meta[wh_meta_title]” id=”term_meta[wh_meta_title]”> </div> <?php } function edit_extra_fields($term) { } function save_extra_fields($term) { } add_action(‘product_cat_add_form_fields’, ‘add_extra_fields’); // For ‘product_cat’ add_action(‘product_cat_edit_form_fields’, ‘edit_extra_fields’); add_action(‘edited_product_cat’, ‘save_extra_fields’);
To add extra fields to taxonomy or category use below hook: add_action(‘categoryname’_add_form_fields,’function_name’); Sample: function add_extra_fields() { ?> <div class=”form-field”> <input type=”text” name=”term_meta[wh_meta_title]” id=”term_meta[wh_meta_title]”> </div> <?php } function edit_extra_fields($term) { } function save_extra_fields($term) { } add_action(‘product_cat_add_form_fields’, ‘add_extra_fields’); // For ‘product_cat’ add_action(‘product_cat_edit_form_fields’, ‘edit_extra_fields’); add_action(‘edited_product_cat’, ‘save_extra_fields’);