0

I´m having a strange issue with featured images. Here´s what I did:

  1. Added theme support for featured images with add_theme_support( 'post-thumbnails' );
  2. Attached a featured image to each post
  3. Included the template tag inside the loop: the_post_thumbnail();

Strangely the featured image isn´t showing.

However, when I create my own img element it does show up:

<img src="' . wp_get_attachment_url( get_post_thumbnail_id($post->ID)) . '" /> 

Does anyone have an idea of what could be the issue here? Or where I could start to look for a solution?

I´m not even sure where to start troubleshooting, so all suggestions are welcome!

1
  • your code looks as if you are working with string concatenation (?) - please show the full code of the template file or function.
    – Michael
    Aug 29, 2015 at 18:42

1 Answer 1

0

Finally found the issue: I was using a filter in my site specific plugin to remove image attributes. Somehow it also deleted the full image URL.

add_filter( 'post_thumbnail_html', 'remove_img_attributes', 10 );

Removing that filter solved the issue.

Your Answer

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

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