Adding Custom Meta Box to Taxonomies

There are basically three main functions which will be used to add custom meta box for taxonomy and these functions are invoked through following hooks.

1. {taxonomy_name}_add_form_fields
2. {taxonomy_name}_edit_form_fields
3. edited_{taxonomy_name}
4. create_{taxonomy_name}

Here, we can replace taxonomy_name with any default or custom created taxonomy accordingly.I have used “Woocommerce product taxonomy” in below mentioned example code and created a plugin for same.Please check the following functions to add custom meta box:

{taxonomy_name}_add_form_fields add new custom field to add new term page form.Here I am creating a field to add a Class for term.

 

 

{taxonomy_name}_edit_form_fields add a custom field on taxonomy term edit page

 

 

 

The next and last function to save to value passed through add or edit form:

 

 

 

4 Comments

Add a Comment

Your email address will not be published. Required fields are marked *