• In case you haven’t come across this problem: WordPress has a nasty habit of deleting div tags if you switch from HTML view to Visual before Updating a page.

    The most vulnerable div tags seem to be ’empty’ div tags, such as:

    <div id="greenLine"></div>

    Over the years many people have offered solutions ranging from disabling the visual editor to installing a replacement to TinyMCE (the WordPress Editor).

    Then 8 months ago, I came across a great little solution (suggested by Atomworks) which was simply to add a comment to any empty tag.

    So

    <div id="greenLine"></div>

    became

    <div id="greenLine"><!-- Green Line --></div>

    8 months ago this was a brilliant solution! Sadly, it no longer works with the latest version of WordPress (3.2.1).

    Fortunately, I’ve just discovered another easy solution (from BashBang Productions) which simply involves adding a little bit of code to a single php file.

    https://www.bashbang.com/geek/div-tag-disappears-in-tinymce/

    If anyone can see a downside with this solution – please let me know

Viewing 1 replies (of 1 total)
  • I lost a whole day trying to solve this! Found this link on my last roll of the dice so thanks heaps. Yey to you good sir.

Viewing 1 replies (of 1 total)
  • The topic ‘How to stop WordPress removing div tags’ is closed to new replies.