Hi, I may be able 2 help with…..
Scan on Demand and Automatically
There are also reports that in certain situations the plugin doesn’t scan on publish, so thumbnails have to be manually scanned. I’d like to fix this, but need some help discovering what circumstances lead up to this.
I faced this problem with gravity forms, it allows user submitted content on the front end and you have options to create a draft, pending review or publish. When using the publish option, video thumbnails doesn’t grab the thumbnail.
I’d like to reiterate, I don’t code, what I’ve done is probably harmful so I’d love some advice. I solved this by removing function video_thumbnails_past_callback() from the plugin and adding to my themes function.php I then changed it to
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 ) . ' - ';
$video_thumbnail = get_video_thumbnail( $post_id );
if ( is_wp_error( $video_thumbnail ) ) {
echo $video_thumbnail->get_error_message();
} else if ( $video_thumbnail != null ) {
echo '<span style="color:green">✔</span> Success!';
} else {
echo '<span style="color:red">✖</span> Couldn\'t find a video thumbnail for this post.';
}
}
?>
So I basically removed the Die, I then put this code within a post loop so it could grab the post id rather than rescanning all posts.
<?php
if (has_post_thumbnail( $post_id ))
{
//do nothing coz it has 1
}
else
{
video_thumbnails_past_callback();
}
?>
It “works”, I’d love to know…… if there is anything wrong with what Ive done as I’m a complete amateur.
Matt