WordPress.org

Ready to get started?Download WordPress

Forums

Visual editor breaks YouTube embedding? (3 posts)

  1. rppjr
    Member
    Posted 4 months ago #

    [Moved from Requests and Feedback]
    We have an annoying problem and wonder if it's a WordPress bug or something we're doing wrong.

    Our company blog has content reviewers who don't know HTML and use the Visual editor to review and edit authors' posts. Authors frequently embed YouTube videos in posts. Our visual design standard calls for the videos to be centered within the main content area, so authors implement them in the HTML editor in a center-styled div tag like this:

    <div style="text-align:center;">
    http://www.youtube.com/watch?v=WHATEVER
    </div>

    The YouTube URL is on a separate line as WordPress requires for it's embedding feature.

    The problem is, when an editor reviews such a post in the Visual Editor, WordPress reformats the HTML and puts the div and the YouTube URL all on one line, like so:

    <div style="text-align:center;">http://www.youtube.com/watch?v=WHATEVER</div>

    Consequently, the YouTube video does not show up because the URL is not maintained on a separate line. We had editors publish several posts in which the embedded vids didn't show up before we discovered this was what was happening. So we're forced to send every video post thru one more step... having the code checked by a code-savvy author.

    This seems like a bug that should be reported, but maybe there's something else we should be doing that we just don't know about? Thanks for any ideas.

  2. Krishna
    Volunteer Moderator
    Posted 4 months ago #

    Try posting only the URL or wrap the URL with [embed]...[/embed]
    http://codex.wordpress.org/Embeds

  3. rppjr
    Member
    Posted 4 months ago #

    That's what we were missing... thanks a lot. The URL alone works of course, but the embedded video frame is always left-aligned, and we need centered. The [embed]...[/embed] all on 1 line, then wrapped in a styled <div> does the trick.

    Thanks again.

Reply

You must log in to post.

About this Topic