TInyMCE object Tag stripped

I need to add the following object tag to a page

<object id="myExperience" class="BrightcoveExperience">
 <param name="bgcolor" value="#FFFFFF" />
 <param name="width" value="648" />
 <param name="height" value="630" />
 <param name="playerID" value="801136430001" />
 <param name="playerKey" value="**********" /><param name="isVid" value="true"/>
 <param name="isUI" value="true" /><param name="dynamicStreaming" value="true" />
</object>

However WordPress is stripping the object tag and everything inside and replacing it with non-breaking spaces.

Read More

The editor I’m using in TinyMCE Advanced on WP .3.2.1, I tried installed TinyMCE config and adding the following to the extended_valid_elements

object[class|id|width|height|codebase|*],param[name|value|_value]

But it’s had no effect, can anyone point me in the right direction?

Related posts

Leave a Reply

1 comment

  1. I’m not 100% sure, but this problem seems related to the unfiltered_html capability restriction.

    unfiltered_html

    • Since 2.0
    • Allows user to post HTML markup or even
      JavaScript code in pages, posts, and comments.
    • Note: Enabling this
      option for untrusted users may result in their posting malicious or
      poorly formatted code.

    An easy fix (and probably a solution even if the issue in not of capabilities) is to make a shortcode to handle the object insertion.

    This example is for inserting a SoundCloud iframe, but easily adaptable to the object tag.

    add_shortcode('soundcloud', 'soundcloud_shortcode_maker');
    
    function soundcloud_shortcode_maker($atts, $content = null) {
        $output = '<iframe width="'.$atts['width'].'" height="'.$atts['height'].'" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url='.urlencode($atts['url']).'&amp;'.myUrlEncode($atts['params']).'"></iframe>';   
        return $output;
    }
    
    function myUrlEncode($string) {
        $entities = array('%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D');
        $replacements = array('!', '*', "'", "(", ")", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]");
        return str_replace($entities, $replacements, urlencode($string));
    }
    

    The function myUrlEncode is just a helper in this specific SoundCloud case, but I’ll leave it here just in case…