WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#16526 closed defect (bug) (worksforme)

Switching from "HTML" to "Visual" view when creating/adding a post deletes some of the code

Reported by: farinha Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.5
Component: Editor Keywords:
Focuses: Cc:

Description

Trying to use Vimeo's embed code in a post. When I add the code in the "HTML" view of a post and hit "Preview", the code works with no problem. But if I switch to "Visual" view (to write the rest of the post, the iframe part of the code gets removed, and so the video no longer appears in the post. Here's the Vimeo embed code:

<iframe src="http://player.vimeo.com/video/19723907" width="540" height="304" frameborder="0"></iframe><p><a href="http://vimeo.com/19723907">Moullinex - Catalina</a> from <a href="http://vimeo.com/moullinex">Moullinex</a> on <a href="http://vimeo.com">Vimeo</a>.</p>

And after switching from "HTML" to "Visual" and then back to "HTML":

<a href="http://vimeo.com/19723907">Moullinex - Catalina</a> from <a href="http://vimeo.com/moullinex">Moullinex</a> on <a href="http://vimeo.com">Vimeo</a>.

Attachments (1)

16526.diff (1.3 KB) - added by garyc40 3 years ago.
Allow iframe in tinymce

Download all attachments as: .zip

Change History (11)

comment:1 follow-up: nacin3 years ago

Do you have the unfiltered HTML capability? (Editor or administrator, or if multisite, super admin.)

comment:2 duck_3 years ago

I can reproduce as administrator user, so seems like something else going on for iframes.

Sidenote you can use the inbuilt oEmbed functionality to embed videos from vimeo (and other providers).

comment:3 in reply to: ↑ 1 linuxologos3 years ago

Replying to nacin:

Do you have the unfiltered HTML capability? (Editor or administrator, or if multisite, super admin.)

I don't think it's a matter of unfiltered HTML. Iframes have been working just like farinha reports since I use WordPress (around 2.5). I haven't even thought it is a bug. :)

garyc403 years ago

Allow iframe in tinymce

comment:4 garyc403 years ago

See: Google Maps iframe Deleted with TinyMCE and Advanced TinyMCE

The patch I attached addresses this. But I'm not sure whether this is plugin material? tiny_mce_before_init is made for this.

comment:5 garyc403 years ago

  • Keywords has-patch needs-testing added

comment:6 kawauso3 years ago

  • Cc otterish@… added

comment:7 follow-up: theBrettman3 years ago

  • Version changed from 3.0.5 to 3.1

I am trying to paste the iFrame into a page and having the same issue in wordpress 3.1.

According to this: http://en.support.wordpress.com/google-maps/, it's supposed to turn the iframe into shortcode after you publish, draft, or update but it's obviously not working in wordpress 3.1. That's odd because that post is from March 3rd so it should work, right? Well, it's not working for me, unfortunately.

comment:8 in reply to: ↑ 7 garyc403 years ago

Replying to theBrettman:

I am trying to paste the iFrame into a page and having the same issue in wordpress 3.1.

theBrettman, please don't change the version number. It's there to track when a bug was introduced / reported.

Also, could you try 16526.diff to see if it works for you? It needs some testing.

Side note: we need to disable this Version dropdown for non-committers.

comment:9 azaozz3 years ago

  • Keywords reporter-feedback added; has-patch needs-testing removed
  • Version changed from 3.1 to 3.0.5

The visual editor doesn't support iframes by default as they are very rarely used (this enhances security for most users too). If you want to use iframes, please make the patch into a plugin.

@theBrettman are you talking about wordpress.com or a self-hosted installation?

comment:10 ocean902 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Since WordPress 3.2 the editor supports iframes – the code from above works.

See #17086.

Note: See TracTickets for help on using tickets.