On my multi-author blog, some authors had been complaining that if they paste an embed code from YouTube in the post, it disappears upon saving the post.
Since I’ve never had this issue, I logged in as one of the authors (who has the problem) from the same computer I write my posts from. Sure enough, as soon as I pasted the YouTube code and saved the post, the embed tag disappeared.
I checked the author’s profile and the “Visual Text Editor” box, was unchecked – which I ask all my authors to do.
Any idea WordPress gurus, what could be going wrong here? We are on WP 2.1
The embed tag is not valid XHTML (or indeed, valid HTML or anything else). The rich editor is probably stripping it out because of that.
Use semantically correct object tags instead.
If your authors don’t understand tags and how to convert and such, install a YouTube plugin and let them use that to create links to YouTube instead. Don’t try using YouTube’s code, like most of those video sites, the code they generate is invalid and frankly untrustworthy.
i also having a problem posting a code on my wordpress, disappears upon saving the post. Is there a plugin that can fix this problem ?
– Otta, the rich text editor (you mean the visual editor…right?) is switched off…
plus how does one explain the fact that if from the same computer when I log in as myself I can easily paste the same code and save it without losing the code. But when I log in as the author who has had the problem, I paste the same code, but upon saving it gets lost… this seems to be a “profile” connected issue… (my guess)
Ahhh. Okay. “Authors”, by default, get their HTML filtered. “Editors” and “Administrators” do not.
Install the Role Manager and see what roles your users have. If you want them to be able to insert HTML without getting filtered, give them the unfiltered_html capability using that.
A link to the Role Manager plugin can be found at the bottom of this page:
I am using admin mode and still my HTML embedding code gets filtered. Hell, even when I paste VALID XHTML code like this:
<object type="application/x-shockwave-flash" data="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" width="400" height="326"><param name="movie" value="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" /><param name="FlashVars" value="playerMode=embedded" /></object>
It gets broken by the visual editor as soon as I re-edit. I can’t wait to find a patch I can insert in the php to fix the WP code somehow – this is a serious bug with the editor and a recurrent trouble with WP v2.1 published again and again in this forum. Most video plugins are buggy and I just wish WP wouldnt filter my HTML/XHTML code.
1) turn off the “correct invalid XHTML” in your options area.
2) the code gets wrapped in <p> tags. It’s easily fixed. Depends on what version of WordPress you’re using. For WP 2.0.x, you have to comment out the “wpautop” stuff in the default-filters.php file. In WP 2.1, you just edit a little bit of your formatting.php file (see this post), this will keep the
<p>tags from wrapping the lines of your embedded code.
Works like a charm 🙂
sorry doodlebee, my “correct invalid XHTML” is off and still the code gets filtered. As I said it is a very serious bug that has been reported all over this forum and there should be a fix on the way – lets hope soon! For the the moment the best fix is one of the following:
1) Go back to WordPress 2.0.x.
2) Dump the visual editor.
2) Make posts and save at once and not re-edit them or WordpRess 2.1 will break your HTML, even if it is valid XHTML.
I am sure the fix is on the way as such a basic feature cannot be so faulty as it is. I have read the fix ticket and I hope a patch shows up.
Otto, I have the Role Manager installed and tried to check the unfiltered HTML option for ‘Authors’ when I got this error:
Fatal error: Cannot redeclare class rolemanager in /home/public_html/passionforcinema-com/wp-content/plugins/rolemanager/role-manager.php on line 22
tec – did you try the solution suggested in my previous post? I did it to my own site, and it works perfectly.
I can confirm the problem exists in version 2.3.1. In the Options area, there’s a checkbox for “WordPress should correct invalidly nested XHTML automatically” (there’s no other option for XHTML). Even with this option deselected, and editing a page when logged in as the Admin, WP breaks the Embed tags.
I’d like to chime in and say this is a problem for WP 2.2 as well. I am an Administrator and have no trouble whatsoever embedding YouTube or Revver videos. However, all of my have their embed code wiped out when they save or publish their posts and I have to come behind them and add it in for them. It’s a bit of a pain!
I too have the XHTML option deselected and I’ve made sure they aren’t using the WYSIWYG editor. Still no dice.
- The topic ‘Embed Code disappears for some’ is closed to new replies.