How do I add and display a custom image field to a category?

I know I need to use the hook 'category_add_form_fields' however I am not quite sure how... I am relatively new to wordpress so any help is greatly appreciated!


2 Answers 2


I have used ACF - Advanced Custom Fields for this multiple times ( http://www.advancedcustomfields.com/resources/how-to-get-values-from-a-taxonomy-term/ ). The problem with taxonomy images & other custom fields is that the values are stored in wp_options table. In bigger sites this will populate the wp_options table a lot and is probably not the most efficient way to store data. You can use advanced techniques to avoid this, but if your site is relatively small, it's okay to use custom fields the way ACF and categories images -plugin (mentioned in answer by lacey tech solutions) do.


I've used this plugin https://wordpress.org/plugins/categories-images a number of times and its great for adding images to categories. Hope this does what you need!

When the plugin is activated on your website and you've added in images for your categories use the following in category.php to output the category images:

  <?php foreach (get_categories() as $cat) : ?>
        <?php if (function_exists('z_taxonomy_image_url')): ?>
           <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
        <?php else: ?>
           <img src="<?php stylesheet_directory_url(); ?>/images/placeholder.jpg" />
        <?php endif; ?>

       <a href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?></a>
  <?php endforeach; ?>

In the example above - if no category image is available you have the option to load in a placeholder image in /wp-content/themes/yourthemename/images/placeholder.jpg

stylesheet_directory_url() will return '/wp-content/themes/yourthemename'


Not the answer you're looking for? Browse other questions tagged or ask your own question.