Support » Plugin: Featured Video Plus » YouTube Video embeds don't respect media size settings

  • My FVP YouTube videos were always displaying full width of whatever parent container they were in, regardless of the media settings entered for Featured Video Plus.

    After much experimentation, I discovered that WordPress was somehow arbitrarily adding “http:” to the YouTube URL source. If you look closely at YouTube video source URLs, you will see that they begin with “//” and do not include “http:”

    If you copy a YouTube embed URL directly from YouTube and paste it into the WordPress Text editor, everything is fine, until you switch between Text and Visual. That’s when WP adds “http:” back into the YouTube source URL and that’s when your embedded video will now be full width of its container, regardless of the dimensions set in the embed code or elsewhere.

    With this knowledge in hand, I modified the FVP file general.php to remove “http:” from YouTube URLs as follows, on or about line 97:

    $src = '//'.$meta['id'].'?theme='.$theme.$wmode.'&color='.$color.'&showinfo='.$info.'&modestbranding='.$logo.'&enablejsapi='.$jsapi.'&origin='.esc_attr(home_url()).'&rel='.$rel.'&fs='.$fs.'&start='.$meta['time'].'&autoplay='.$autoplay;

    Now, FVP respects the media dimension settings.

  • The topic ‘YouTube Video embeds don't respect media size settings’ is closed to new replies.