Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#35953 closed defect (bug) (invalid)

WordPress mess up my posts and pages when im putting html and scripts in it

Reported by: rigpa1's profile rigpa1 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4.2
Component: Editor Keywords: close
Focuses: Cc:

Description (last modified by ocean90)

I am so sick and tired of WordPress messing up my scripts on posts and pages when switching from text to visual.

When I put something in there it is because I intend it to be there. I don't want WordPress to make changes to my code!!

I have this line: <td valign="top" align="left" width="100" height="10"><a href="infrarod-cyan" onMouseOver=" switchimages('Bimage0',1); return true" onMouseOut=" switchimages('Bimage0',0); return true" onClick=" switchimages('Bimage0',2); return true"><img name="Bimage0" src="/wp-chili-matrix/ChiliMatch_C2_R2.jpg" width="100" height="10" border="0" alt=""></a></td>

and it gets changed to this: <td align="left" valign="top" width="100" height="10"><a href="infrarod-cyan"><img src="/wp-images/com_C2_R2.jpg" alt="" width="100" height="10" name="Bimage0" border="0" /></a></td>

Which means my mouseover stops working.

It took me months to figure out that it is WordPress (not the editor) that deletes my code and every time I accidentally switch from text to visual OR if the editor opens in text the code gets ruined.

I want to be able to trust that what ever I put in there is going to STAY there!!!

Change History (3)

#1 @DrewAPicture
8 years ago

  • Component changed from General to Editor

#2 @ocean90
8 years ago

  • Description modified (diff)
  • Keywords close added
  • Summary changed from Wordpress mess up my posts and pages when im putting html and scripts in it to WordPress mess up my posts and pages when im putting html and scripts in it

The visual editor is not an HTML editor. You can reproduce the issue in the TinyMCE editor demo too.
If you're adding custom HTML you shouldn't use the visual editor at all.

#3 @azaozz
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Support for on* attributes (onMouseOver, onClick, etc.) was removed couple of years ago as they are unsafe. Also, that HTML seems very very outdated. Most of the <td> attributes are not used any more. The Visual Editor supports HTML 5.0 but leaves legacy code in place, for now.

As ocean90 said above, if you must use that HTML, only use the Text editor. It is not supported in the Visual editor.

Note: See TracTickets for help on using tickets.