Support » Fixing WordPress » Disable embed when object is used.

  • I’m just curious if it is possible to disable WordPress from adding the embed tag everytime I post an object tag (youtube video,etc).

    I tried hunting down the javascript that was automatically entering the embed tag, but was unable to accomplish this. I edited atleast 2-3 files, but it made no difference.

    My goal in this is to eliminate the embed tag so my site will pass validation. The embed tag is invalid and it’s just annoying to me. Opera, Internet Explorer and Firefox all show flash videos perfectly fine with the object tag, but I just can’t figure out how to get ride of the embed tag without manually editing the post with phpMyAdmin.

    Any help is greatly appreciated. Thanks in advanced!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter kyleabaker

    (@kyleabaker)

    …help?

    yes there is…

    stop using that stupid visual editor.

    Thread Starter kyleabaker

    (@kyleabaker)

    @ivovic
    I know how to write all of the html myself (obviously since I’m working to correct wordpress to make all of my posts valid markup since the embed tag is used by default and is not valid), but the problem is that when I click save/publish it always “corrects” the object tags by adding the embed tag. The only way I can get around this is to disable javascript in my browser each time I want to make a post with the object tag and avoid getting the embed tag automatically included. Or I can manually edit the mysql entries.

    I was actually aiming for some help that was a little more on track. Anyone else care to help me find a way to disable the embed tag?

    You shouldn’t need to disable anything.

    This works perfectly fine when not “using that stupid visual editor.”

    <object type='application/x-shockwave-flash' data='http://www.youtube.com/v/6mUMV-hrlHw' width='298' height='250'>
    <param name='movie' value='http://www.youtube.com/v/6mUMV-hrlHw' />
    <param name='FlashVars' value='playerMode=embedded' />
    </object>

    Kyle, you should try paying attention rather than ‘correcting’ people who are offering assistance.

    Disable the visual editor and you won’t have this issue

    Thread Starter kyleabaker

    (@kyleabaker)

    @Ivovic
    I’m not trying to correct you. The visual editor is not a problem. It generates valid html except for the embed tag. I’m trying to find out which file to edit to disable the javascript from adding the embed tag period.

    I’ll disable it temperarily, but I’m still trying to find the javascript that is generating the embed tag so I can just cut that part out.

    @greenshady
    That is the markup that I used on my old blog. The thing is..I don’t mind the visual editor. The problem with it is all in the javascript. That can be corrected and then I would have no reason to disable the visual editor.

    pardon the pasting using the windows forward slashes

    Kyle, please go get a copy of wingrep, then YOU can do this the next time.

    wordpress-2.5\wordpress\wp-admin\js\editor.js :

    if ( content.indexOf('<object') != -1 ) {
    content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
    content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
    }

    wordpress-2.5\wordpress\wp-includes\formatting.php :

    $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
    if ( strpos($pee, '<object') !== false ) {
    $pee = preg_replace('|\s*<param([^>]*)>\s*|', "<param$1>", $pee); // no pee inside object/embed
    $pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);

    If you have already edited those 2 instances, then go get wingrep, and look at the other 11 files that embed shows up in.

    Thread Starter kyleabaker

    (@kyleabaker)

    @whooami
    Thanks, this was exactly what I was after. I’ll update everyone once I find the files that fix this.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Disable embed when object is used.’ is closed to new replies.