i want to display custom taxonomy images on index.php and for this reason i installed this plugin. I uploaded my taxonomy images but i couldn't display images on index. I tried the codes which are given by the plugin author.

print apply_filters( 'taxonomy-images-queried-term-image', '' );

etc. But it didn't work. I think this code has no echo function, am i right? And the URL, which you can see the below, is my custom taxonomy URL.


So how can i display my custom taxonomy images on index.php? Thanks a lot.

2 Answers 2


Just like we use get_terms() to get all the terms in a custom taxonomy we can get all the taxonomy images with the below code. Place this code outside the loop to list all the taxonomy images.

$terms = apply_filters( 'taxonomy-images-get-terms', '', array(
    'taxonomy'     => 'ff-portfolio-tag',
) );
if ( ! empty( $terms ) ) {
    print '<ul>';
    foreach ( (array) $terms as $term ) {
        print '<li><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'detail' ) . '</li>';
    print '</ul>';

Are you looking at a taxonomy archive page? You mention you want to display it on index.php, but since a theme can technically have only that template for all possible URLs that doesn't really give meaningful information.

As the note on the plugin page says, that filter is for displaying the images on a page that has a term in its context, so if you aren't trying to view a taxonomy archive or similar then it won't work.

I use this plugin all the time and as long as you dig into the documentation, everything is pretty clear.


$terms = apply_filters( 
        'taxonomy' => 'ff-portfolio-tag',
print_r( $terms );

... for example.

  • Well, i think we come close to the true way. I added your code to my theme file. But i got this error on index: Array ( [0] => WP_Term Object ( [Term_id] => 3 [Name] => Branding [Slug] => Branding [Term_group] => 0 [Term_taxonomy_id] => 3 [Taxonomy] => Ff-Portfolio-Tag [Description] => [Parent] => 0 [Count] => 4 [Filter] => Raw [Image_id] => 5152 ) ) @AndyMacaulayBrook Aug 12, 2016 at 20:37
  • That's not an error. print_r just dumps out the array so you can see what's in it. If you grab that Image_id in your code you can use it to generate the right <img> tag. Aug 12, 2016 at 20:43
  • @Katzenliebe : error!! What?? You're developing custom theme without knowing what is print_r .. I guess now any one can tell why WordPress sites get hacked so many times.. very sad !! Aug 13, 2016 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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