WebDevStudios / Automatic-Featured-Images-from-Videos

If a YouTube or Vimeo video exists in the first few paragraphs of a post, automatically set the post's featured image to that vidoe's thumbnail.
33 stars 24 forks source link

"_is_video" key is added to all posts? #11

Closed crispinbixler closed 8 years ago

crispinbixler commented 8 years ago

I'm noticing that the key "_is_video" is applied to all posts whether there's a video or not.

This is affecting a conditional statement that we're using.

I'm sure I'm overlooking something but thought I'd ask. Should the value for the key be blank? I don't see a value associated with the _is_video key.

Using a plugin called "Post Meta Inspector" I'm seeing this output for video and non-video posts: Key Value _is_video '' "

Thanks for any clues - let me know what other info you need. :) Regarding this site: mofaul.com/blog

tw2113 commented 8 years ago

It does indeed look like it is getting set on the post regardless.

if ( ! $do_video_thumbnail ) {
    return update_post_meta( $post_id, '_is_video', false );
}

However, it's also being set to boolean false when there is none found. Not sure the logic there at the time as I wasn't on the original team for this plugin. If you check for empty() or do a comparison to false, that should help at the moment with preventing doing anything when no value is available.

crispinbixler commented 8 years ago

Thanks for getting back to me so quickly and for the tip. :)

tw2113 commented 8 years ago

Welcome. :)