I am making some changes to a custom WP template and have hit an odd issue. Published posts work absolutely fine, but when you view a scheduled post the Featured Image disappears.
It's as if there was no featured image at all and has_post_thumbnail()
returns false. Here's the relevant piece of code I'm working with, relatively simple stuff really:
while (have_posts()) : the_post();
if (has_post_thumbnail($post->ID)) {
$featuredImage = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
}
}
And again, this works fine on published posts but as soon as I set the date to the future the image stops coming through. It seems strange that images would be treated differently based on the publish date, is there anything which WP changes on scheduled posts vs live posts which could be causing this?
if ( has_post_thumbnail() ) { the_post_thumbnail(); }
– Robert hue Jan 9 '15 at 6:01has_post_thumbnail()
failing is becauseget_post_meta()
returns empty, still looking in to why that is! – Andrew Jan 15 '15 at 4:01