Support » Fixing WordPress » WordPress 2.1 always format my code

  • Till version 2.1 wordpress has just decided to always reformat my code. I wrote in the editor (not visual) the fellowing code:

    <script src=”” type=”text/javascript”></script>
    <script type=”text/javascript”>
    window.onload = SetDefaultDates;
    <div class=”animation”>Radar’s picture from
    <input type=”text” id=”vonDatum” /> at
    <input type=”text” id=”vonZeit” /> to
    <input type=”text” id=”bisDatum” /> at
    <input type=”text” id=”bisZeit” />      
    <input name=”_ctl1:derButton” id=”_ctl1_derButton” type=”button” value=”animate” class=”mybutton” onclick=”PrepareAnimation()” />
    <span id=”DatumFehler” style=”display:none”>Date is not valid. Valid format ‘'</span>
    <span id=”ZeitFehler” style=”display:none”>Time is not valid. Valid fomrat ‘hh24:mm'</span>
    <span id=”keineDaten” style=”display:none”></span>

    Explanation about this image can be found here (french only).

    Image of <span id=”datum”></span>
    <div class=”radarrahmen”>
    <div class=”radarbild”>
    <img id=”radar” src=”” alt=”” />
    <img src=”” alt=”Skala” id=”skala”/>


    and It’s always displayed as:
    <script src="" type="text/javascript"></script>
    <script type="text/javascript">
    window.onload = SetDefaultDates;
    <div class="animation"><p>Radar’s picture from</p>

    <input type="text" id="vonDatum" /> at</p>
    <input type="text" id="vonZeit" /> to</p>
    <input type="text" id="bisDatum" /> at</p>
    <input type="text" id="bisZeit" />      </p>
    <input name="_ctl1:derButton" id="_ctl1_derButton" type="button" value="animate" class="mybutton" onclick="PrepareAnimation()" />
    <span id="DatumFehler" style="display:none">Date is not valid. Valid format ‘’</span>

    <span id="ZeitFehler" style="display:none">Time is not valid. Valid fomrat ‘hh24:mm’</span>
    <span id="keineDaten" style="display:none"></span>
    <p>Explanation about this image can be found here (french only).
    <p>Image of <span id="datum"></span></p>
    <div class="radarrahmen">
    <div class="radarbild">

    <p><img id="radar" src="" alt="" />
    <img src="" alt="Skala" id="skala"/>

    Even if I hack directly in the database this damned version 2.1 still find sensefull to reinterpret my code, that is add some fancy <p></p>.

    Did I miss a new option of version 2.1. How to fix this very annoying behaviour.

    Thanks in advance. Jerome

Viewing 13 replies - 1 through 13 (of 13 total)
  • I have not the same, but a similar problem. WP is hiding my images, which I put into my topic.

    I use this image-tag:
    <img src=”” alt=” – Die Welt der Smilies ist nicht immer nur gelb!” width=”468″ height=”60″ />

    And WP 2.0.8 and 2.1 make this:
    <img src=”” style=”display: none;” alt=” – Die Welt der Smilies ist nicht immer nur gelb!” height=”60″ width=”468″>

    You can see (or better, you can’t see) it also on my test blog:

    By default, the visual posting box is NOT activated. It is not like wp2.0 any more, but you can activate the visual edit box in administrator’s manage panel.

    Login into manage panel —> users —> (chose your username)edit —> Your Profile

    and check “Use the visual editor when writing” —>click “update profile”

    and return to the posting page, you will see the visual posting panel you want.

    hoping my reply can give you some help

    Thanks veola, but we both are using the editor without the wysiwyg-option.

    Actually, by checking “Use the visual editor when writing” option, the default editor will be set to be “wysiwyg” but there’s is no HTML CODE EDITOR any more. It’s really a big problem. some html tag symbols will be reformatted when you click “post” button.

    you type
    var book={title:'bookTitle', author:'nate', id:222};

    and click “post”

    the code you typed will be change to be
    var book={title:’bookTitle’, author:’nate’, id:222};

    I don’t know why wp’s dev team change the editor worse than version 2.0

    I had the same problem [spikesoft] explains above after upgrading to 2.1. I like using the rich text editor just for simplicity, but it was keeping me from being able to embed movies from YouTube on my site. I don’t have the problem if I disable the rich text editor…uncheck it in my profile.

    So, what I ended up doing was to create a second administrator account for myself and set it NOT use the rich text editor. When I want to embed some code, I log in on that second account….for my normal posts, I log in on my primary account so I’ll have the rich text editor by default.


    by the way, I’m trying to repot the editor of wp2.0 to wp2.1.

    It sounds very insinuative,but honestly, i think wp2.0’s editor is better.

    I will share the method of repoting the editor if i get though.

    Solution to running javascript from within a post.

    Use Lorelle’s version – works like a charm.

    I am finding that the code editor for posts is changing divs to p tags! WTF? Even if I paste the correct stuff back in, any edit to the page/post causes this freaking corruption again…

    what the hell is that all about?

    also, 2.1 by default appears to add in strange P tags and if you open a previously saved post it changes DIV tags to P tags. I fixed both of these issues by following the two fixes on this article:

    One issue is a config change to do with the TinyMCE WYSIWYG editor and another with the formatting.php file in the wp-includes directory

    I’m glad I’m not the only one having this problem. WP is putting my each of my form elements on individual lines, despite my taking them out when using the text editor.

    Would love to see some feedback/response from a moderator or developer with an official word on this. 😛


    I withdraw my request in the second post, it isn’t an WP issue, it was my Adblocker… 🙁 *shame on me*



    I have found a solution for effective embedding Javascript code in the WordPress posts (this is for WP2.2.2 which i use)

    While I failed to suppress or disable script code formatting in the WP options, I found that using external scripts can solve this problem effectively. WordPress still wraps my scripts in the paragraphs, but now scripts work.

    So, instead of writing javascript code directly in the page, it is better to externalize the script to file and refer to it like this:

    <script type=”text/javascript” language=”javascript” src=””></script> (I’ve applied this solution at the my blog page where I embed javascript for adding my own Firefox Search plug-ins for Flash, Flex, and Adobe Labs)

    Hope this will help someone. However, if I had better solution, I’d be glad, so maybe someone can tell me how to stop auto code formatting in the WP2.1.

    Otherwise, I’ll be forced to write my own wordpress plug-in for intelligent javascript embedding! 🙂

    Hey Rost, thanks for the tip. I tried that and it worked perfectly. I had a terrible problem with WordPress treating javascript as text and inserting <P> tags all over the place. Thanks again!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘WordPress 2.1 always format my code’ is closed to new replies.