Home » Blog » WordPress » Upgrading WordPress » Visual Editor - A Tip …

Visual Editor - A Tip …

I saw this when testing a fairly complex page (the RapidNicheWebsites.com home page) - which has a number of DIV tags and class / css settings.

The good news is that the Visual editor does NOT screw up your DIV tags by replacing them with P tags. However, it does remove any tags that are deemed to be invalid in any of the standard HTML tags. So - as I saw in the Enlarger plugin, a dummy attribute inserted in the IMG tag so that the plugin could intercept that tag was immediated removed bu the tinyMCE (editor) filters.

What does not get removed are the class and style attributes, as well as any attributes which are acceptable XHTML attributes for that particular HTML tag.

So - in my home page, I had <DIV align = “center”> - and the align tag got removed - apparently because the tags is being depreciated in XHTML - so is not considered valid. A simple change to <DIV style = “text-align: center”> - and my DIV tag centered - as the Visual editor did not remove the style attribute. In a similar way, class attributes are also retained.

So - if you like to add in custom formatting tags, you need to just check your code after you have saved in Visual mode. If you see that the tag attribute is being removed, create either a class or an inline style equivalent, and you should be able to have the formatting option that you want, and still do most of you editing in Visual mode - without worrying about your tags being stripped.

Want To Provide Some Feedback?

You must be logged in to post a comment.