This is happening because the thumbnail URL is saved as a custom field with the post. When deleting the images from the media library, the custom field information is left behind. When scanning past posts, it’s seeing that the custom field already has a URL.
Here’s what you should try. Open the plugin with the editor and look for this section:
function video_thumbnails_past_callback() {
global $wpdb; // this is how you get access to the database
$post_id = $_POST['post_id'];
echo get_the_title($post_id) . ' - ';
if ( ($video_thumbnail=get_video_thumbnail($post_id)) != null ) {
echo '<span style="color:green">β</span> Success!';
} else {
echo '<span style="color:red">β</span> Couldn\'t find a video thumbnail for this post.';
}
die();
}
Now replace it with the code below, which adds in the delete_post_meta line:
function video_thumbnails_past_callback() {
global $wpdb; // this is how you get access to the database
$post_id = $_POST['post_id'];
echo get_the_title($post_id) . ' - ';
delete_post_meta($post_id, '_video_thumbnail');
if ( ($video_thumbnail=get_video_thumbnail($post_id)) != null ) {
echo '<span style="color:green">β</span> Success!';
} else {
echo '<span style="color:red">β</span> Couldn\'t find a video thumbnail for this post.';
}
die();
}
This should clear out the custom field before searching. Remove the line once you’re done so that if you ever need to scan old posts again you won’t be doubling images.
Works! Thank you very much for a quick help!
While not creating a new thread, i want to ask, if it’s possible to remove the big thumbnail from the post, while leaving the small one in article feed? Also leaving the ability to see the thumb, when sharing the post in facebook.
Thanks in advance!
I unticked the “Set as Featured Image” tick box. No big featured image is above my video anymore(as i want), but also no thumbnail in facebook share(as i don’t want) π
If you edit your theme, you can add a meta tag that notifies Facebook about your image. Put the following somewhere in the <head></head> section:
<?php if (is_single() && ( $video_thumbnail = get_video_thumbnail() ) != null ) { ?><meta property="og:image" content="<?php echo $video_thumbnail; ?>" /><?php } ?>
You are awesome!
It works!
RESOLVED!!! π
The plugin is not showing thumbnails for me on one of my sites. I am using the same theme on both and so thats not it. The thumbnails are in my library but do not show on my category pages. I have deleted the plugin reinstalled and tried the above fix none of them worked.
Any Ideas??
I had already done that before I posted here. This has not worked for me there are still no thumbnails although they show in the library.
I deleted all the library thumbnails. Place the above delete line in the proper place. reran the search old posts and it still does not show on my
Category page
The thumbnails show on the category page on one of your sites but not the category page of another with the same theme? If they’re in the library and set as the featured image, the plugin is doing everything it can. Try uploading any image and setting it as the featured image, if that image doesn’t appear on the category page then it’s something with the theme.
Thank you so much for your help. It is an awesome plugin and I’ve got it working on both sites! What I had done is change the content to excerpt in the <div class = “postcontent” in both my Main index template and archives files. I went to your main site and read through the comments. That triggered my memory! I am following an instructor 300 IM, who asked us to do this at one point. As soon as I changed it back to content – it works just as you programmed it ti work.
You’re right – the plugin is doing everything it can!
Thanks again Esther