How to add images to taxonomies?

Q: Is it possible to add images to all of my taxonomies (default and custom ones)?

Note: I do not want to use any plugins (not my favourite solution for design related matters).

Usage: I want to create really practical custom post type portfolio with custom taxonomies. For example, custom taxonomy – clients, so if multiple projects from same customer/client would be realted and at the same time I could use the taxonomy as showcase of my clients. The similar usage would go with almost of my taxonomies (whether to have taxonomy archive with image and description on).

Any good practice advice here? Thanks in advance

Clarification: I want to add images to the terms of my custom taxonomies. Example, custom post type ‘portfolio’ with custom taxonomy ‘clients’, where each ‘client’ term (lets say Adidas) would have its logo attached.

3 s
3

Starting from WordPress 4.4, you can use add_term_meta function to store metadata for a term. This is basically a key-value pair information which is stored in wp_termmeta table.

Original (Prior to WP 4.4)

WordPress doesn’t have the option to add extra information to taxonomies. There isn’t any taxonomy_meta table. So, you have two options.

  • Create a new custom table and save the extra information(image link) there.
  • You can also use options table to store the information.

You can follow this post of as it shows how to implement what you are trying to do: http://en.bainternet.info/wordpress-taxonomies-extra-fields-the-easy-way/

Leave a Comment