Taxonomy Custom Meta Fields

Adding custom meta fields to taxonomies can be useful for associating images, icons or more information to custom taxonomy terms in WordPress. Custom meta fields can also be added to posts, pages and custom post types.

Three functions can be added to your WordPress theme’s functions.php

The first function the term’s custom meta field to the ‘add new term’ page.

 

Note the add_action() parameters.

 

You can tweak the first parameter {taxonomy_name}_add_form_fields to set what taxonomy the field gets added to. In my examples, I will be using the “category” taxonomy.

Next we need to add the function that displays the custom meta field on the ‘edit taxonomy term’ page.

 

Finally, we need to add the last function, which saves all the data we have inputted into the fields.

 

As we did in step one, make sure you modify “category” from the add_action() parameters at each step, to reflect the taxonomy you want the field displayed in.

Reference: Pippin

To display the data on the frontend: