Back to Top

How to add extra field in Custom Taxonomy WordPress?

To create extra field into category or Custom Taxonomy in Wordpress

Today I am going to explain about to create extra field into category section or custom Taxonomy in WordPress.

Sometimes in WordPress, we need some extra fields into category or custom taxonomy like an image for a category or detailed description etc. So we thanks to WordPress that provides action hooks using that we can create action hooks in that without any plugin.

Yes, without a plugin, It’s better to code itself because plugin might have some extra code or code which can’t support in next version of WordPress. So try to minimize the use of plugins in WordPress and code by yourself. It’s quite easy to write such a code in WordPress.It may take few mins.

Let’s check out code and understand:

First of all, let’s create action hook for adding html for new field into category or Custom Taxonomy.

Read about :To Configure Auto Updates in WordPress

Next,action hooks are for saving that new field into a database after created or updated.

Also Read: Customize Search in WordPress

well, If you create some fields in the term, then you need to remove that field when delete term. so next filter hook is about for same.

Below action hooks are to display newly created field into display section of taxonomy which is dependent on a version of WordPress too.

That’s it. Like I said, quick but exceptionally handy.All you need to do is just copy and paste above code into your theme’s functions.php file and replace {$taxonomy} with your desired taxonomy.

As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (5)

  1. Uday Ghulaxe says:

    I want to attach a upload image field to taxonomies

  2. Hi there, thanks for the article! I was just wondering, where do I add this code, how would I upload images and then how would I get the image in a template!?

    Thanks for your help!

    1. I have already mention in post where to put code. pl read again.

  3. Thanks for the guide. Very useful.

    There is a slight typo in the last function declaration to show the value in the display section, it should be:

    function taxonomy_columns_type_manage( $out ,$column_name, $termid) {

  4. i want to know how to show output extra fields value?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to use HTML5 AutoFocus attribute

Posted on 3 years ago


What is Type Hinting in PHP5

Posted on 7 years ago


How to set Module Position in Joomla

Posted on 6 years ago


Introduction to PDO in PHP

Posted on 3 years ago