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.

Solutions Collecting From Web of "How to add images to taxonomies?"

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 Answer(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:

You can use the Advanced Custom Fields plugin to add a custom field (an image field) to your custom taxonomy group.

WordPress 4.4 introduced Term meta, which means we can now add custom fields to terms just like we do with posts, without hacky code.

Currently though the WP Tax/Term backend UI lacks of an Image selector (and might never have it), but here you’ll find a good guide on what was added in WP 4.4

If you won’t build your own plugin, then some existing plugins may have already switched to it. I’d advise using a plugin that has already switched to this, e.g. WP Term Images, rather than others that may still use their own DB tables, or worse, WP options tables.