WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Why is WP modifying HTML code entered into the post window? (2 posts)

  1. adriangab
    Member
    Posted 7 years ago #

    Hi All,

    I've since upgraded to 2.1 and something strange is happening.

    In the write post window. I have entered the following HTML code, which is an image thumbnail with a link to the larger sized version:

    <div class="caption left">
    <a target="_blank" href="http://site.com/image.jpg">
    <img alt="Image Name" title="Image Name" src="http://site.com/image.thumbnail.jpg" />
    </a>
    <div align="center">Image Name</div>
    </div>

    I got the idea for this code from a wordpress article that I read in April last year:
    http://codex.wordpress.org/Wrapping_Text_Around_Images

    The code has been working fine on the previous version of WordPress. In the new version of WordPress, after publishing the post, when I look at the web page source of the blog through a web browser, the code has been modified slightly as seen below:


    <div class="caption left">
    <p>
    <a target="_blank" href="http://site.com/image.jpg">
    <img alt="Image Name" title="Image Name" src="http://site.com/image.thumbnail.jpg" />
    </a>
    </p>
    <div align="center">
    <p>Image Name</p>
    </div>
    </div>

    If you look closely, WordPress has inserted paragraph tags <p> around the image and link, and around the caption text.

    If I compare the page source of the page generated by the previous version of WordPress when compared with version 2.1, the only difference is the paragraph tags. It was not putting them before.

    The problem is:

    A) it's modifying code I have entered. I would prefer it not to do this.
    B) it's causing the size of the thumbnails to go crazy in firefox (IE6 and Opera9 are fine). This was not occurring before in the previous version.

    Any help on this would be greatly appreciated.

    Thanks in advance,
    Adrian

  2. adriangab
    Member
    Posted 7 years ago #

    Woo hoo! I found a fix:

    http://wordpress.org/support/topic/102799

    Essentially, just comment out line 66 in formatting.php in the wp-includes directory.

Topic Closed

This topic has been closed to new replies.

About this Topic