Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Text editor changing HTML markup

Discussion in 'Misc WordPress Requests' started by johngoold, Dec 4, 2017.

  1. johngoold

    Guest

    Text editor changing HTML markup, by johngoold

    There are several problems.

    1. When switching to the Visual Editor, all the code is squished together. This isn’t too much of a problem as switching back to the Text Editor and doing an “Update” reformats the code reasonably.
    2. When doing an “Update” in the Text Editor, the mark-up is changed. My main reason for using the Text Editor is to avoid having my markup changed.
    3. The changes result in invalid HTML code (for example, adding a closing paragraph tag that has no matching opening paragraph tab.

    Here is a small “Before Update” and what it was transformed into (this is real, live code):

    <!-- ============================================================ -->
    <a title="MPP Offer of the Month" href="http://teachbridge.com/index.php?id=57">
    <div style="clear: both;">
    <img style="float: left; padding-right: 20px;" src="wp-content/images/icons/bulk-order.jpg" width="100" alt="icon" />
    <h3>MPP Offer of the Month</h3>
    <p>For Teachers Only: August-September 2017 Bulk Discount</p>
    </div>
    </a>
    <!-- ============================================================ -->

    Here’s the result of doing an “Update”:

    <p><!-- ============================================================ --><br />
    <a title="MPP Offer of the Month" href="http://teachbridge.com/index.php?id=57"></p>
    <div style="clear: both;">
    <img style="float: left; padding-right: 20px;" src="wp-content/images/icons/bulk-order.jpg" width="100" alt="icon" /></p>
    <h3>MPP Offer of the Month</h3>
    <p>For Teachers Only: August-September 2017 Bulk Discount</p>
    </div>
    <p></a><br />
    <!-- ============================================================ --></p>

    The comments in the code are there purely to assist me and often get removed from my final version (well, as final as any document ever becomes!).

    The main thing that bothers me, other than having to figure out workarounds for these problems, is that the changes sometimes result in illegal syntax (the dangling closing paragraph tag).

    I cannot disable basic WordPress code (such as the auto-paragraph, or whatever it is called), as there is a need to switch between editors and eventually other people will be posting contents (pages as well as posts) to the website.

    Text editor changing HTML markup
     
    #1

Share This Page

Web Hosting