WordPress.org

Ready to get started?Download WordPress

Forums

wordpress 2.0 altering tags (br and p) (14 posts)

  1. rudeboy
    Member
    Posted 8 years ago #

    since upgrading to 2.0 from 1.5 i've been having problems with wordpress changing the contents of my posts. the rich editor was horrible and added dozens of <strong>, <big>, and <div> tags everywhere so i had to disable it. i figured that would fix the problems i was having with the code i was typing making it to the browser.

    now, using the plain html editor i find the same thing is happening. line breaks are being replaces with empty paragraphs and some line breaks are being dropped out completely.

    for example, i have a screenshots page on my site worked fine before. each screenshot, a title and a description were kept in a css defined box with a line break between each box. like so:

    <div class="box"><strong>title</strong>
    <p>description</p><br clear="left" /></div>
    <br>
    <div class="box"><strong>title</strong>
    <p>description</p><br clear="left" /></div>
    <br>

    the code that is sent to the browser is:

    <div class="box"><strong>title</strong>
    <p>description</p><br clear="left" /></div>
    <p></p>
    <div class="box"><strong>title</strong>
    <p>description</p><br clear="left" /></div>
    <p></p>

    i went so far as to edit the code directly in the database with phpmyadmin and it still doesn't work. the code simply will not make it to the browser intact. wordpress is somehow editing it and replacing tags. this has not only caused my design to break, but my xhtml doesn't validate either as single <p>'s are being thrown in as well without a closer.

    other people have run into this, but there's no clear resolution as to why WP2 is replacing tags and how to fix or disable the "feature". i just want the code in the post's cell to actually make it to my browser unedited. any idea how to accomplish this?

    i'll post a link to the page in question if necessary...

  2. pcmt
    Member
    Posted 8 years ago #

    I see what you mean. But your code is semantically incorrect. I've tried to post a corrected version here, but it keeps on getting reformatted in this post.

    Remove your line breaks, and in your stylesheet style your "box" div to clear left. You also need a carriage return before and after your div tags.

    <strong>title</strong> and <br /> are inline tags and both need to be within a block level html element like a heading or paragraph. So really, WordPress is attempting (rightly) to generate semantically correct markup.

  3. rudeboy
    Member
    Posted 8 years ago #

    my point isn't about my design (which is still a work in progress), but rather tracking down why wordpress is editing my code. no matter what i insert into the database, be it with the rich editor, with the plain html editor or by hand directly into the cell, the code is changed by the time it gets to the browser.

    my main concern is that it's throwing out tags that should be there and inserting tags that i never typed. these extra paragraph tags are ruining my page's xhtml validation because WP2 is currently inserting 9 open <p> tags that shouldn't be there.

    i need to get this figured out not only for my page validation, but to avoid this problem in the future. anyone know how to get wordpress to not reformat and edit code before it's sent to the browser?

  4. Chris_K
    Member
    Posted 8 years ago #

    Have you unticked "WordPress should correct invalidly nested XHTML automatically" in the formatting section of Options -> Writing?

  5. pcmt
    Member
    Posted 8 years ago #

    As I said, WordPress is trying to make your non-semantic code semantic... nothing to do with design.

  6. Davoron
    Member
    Posted 8 years ago #

    this new WYSIWYG Editor is a problem.
    It cant be that the code I typed changet over time I saved!
    I have a Page, whith a table, in some <td> i have content like

    Firstname Name
    Position in company

    Tel. E-Mail-adress

    i wrote and saved it... all right

    i edit but do not change it and save... result:

    Firstname Name
    Position in company
    Tel. E-Mail-adress

    i edit but don`t change and save it secont time
    result:

    Firstname Name
    Position in companyTel.
    E-Mail-adress

    and so on!! that can not be!!

    maybe some one have a oppinion, what i can do... I have to use a WYSIWYG editor.. not for me but for the people who use it...

    very thanks for all oppinon
    (sorry for spelling my english-writingskills are not soo good...^^')

  7. Samuel B
    moderator
    Posted 8 years ago #

    Did you see this above?
    "Have you unticked "WordPress should correct invalidly nested XHTML automatically" in the formatting section of Options -> Writing?"
    Worked for me a while back.

  8. nelly
    Member
    Posted 8 years ago #

    I'm also having problems with <p> tags being inserted where I don't want them.
    I have unticked "WordPress should correct invalidly nested XHTML automatically".
    One example is trying to write a post that simply contains an <a></a> tag. The template is going to wrap <p> tags around it, but WordPress is also inserting its own <p> tags so I end up with a double set.
    Is there anyway to turn this off and just have returned whatever I put in? Regardless of any other consideration, surely there must be a way to just have my db contents returned without tampering?

  9. 24fc
    Member
    Posted 7 years ago #

    I agree with you. I hate it.

    I have to say that I think that XHTML validation is probably the dumbest idea I have ever seen in my life where the web is concerned. The definition of XHTML should be widened to make it flexible enough to allow someone who is uninterested in it and not likely to care about it much to use it without violating it.

    All of this blogging software is in the hands of people who do not know XHMTL. They might know scant HTML. They put HTML in their blogs - such as image tags - and don't self-close the tag. Viola! Validation error.

    And yet it displays fine in a browser.

    The blogging software should not be trying to "fix" this sort of thing. It should instead be allowing it, and the W3C should get off their high-horses and stop trying to deprecate things that millions of people are trained in and want to use.

    The current practice of trying to develop what is essentially language by publishing updated versions and then attempting to require that everyone use it is as doomed to failure as is attempts by schools to get children to stop saying "ain't."

    Now that I am done with that rant, I also agree that WordPress should display all tags - the RAW CODE in the post content. It should not be hiding it from me so that I cannot edit it, and it should not be adding to it or changing it to make it validate, because this causes it to not validate, and prevents someone who does not know XHTML very well from even seeing what the problem is so they can fix it when the code that won't validate is inside the post_content of wp_posts.

  10. Chris_K
    Member
    Posted 7 years ago #

    Nice rant. I'll go with an 8.5.

    Meanwhile, have you considered that you can disable the Wysiwyg editor and SEE all the tags? (Users -> Your Profile, bottom most option - uncheck it).

  11. whooami
    Member
    Posted 7 years ago #

    And yet it displays fine in a browser.

    There's where your wrong. It doesnt display fine in a browser. Atleast not all browsers. And thats the key to "standards compliance" whether the standard is XHTML 1.0 or HTML 4.0

    The fact is that XHTML isn't that far removed from HTML 4.0 that someone that has experience with latter can't get the former, IF they try. The vast majority just don't try, they would rather complain.

    All of this blogging software is in the hands of people who do not know XHMTL. They might know scant HTML. They put HTML in their blogs - such as image tags - and don't self-close the tag. Viola! Validation error.

    Thats not WordPress' problem now is it? That someone doesnt want to educate themselves ..

    All of this blogging software also appears to be in the hands of people that cannot chmod, dont know how to use an ftp client, cannot remember how to "view source" in a browser they have used since the turn of the century, don't know how to use a search engine, cannot read README's, cannot unzip a zip file, and so on and so on and so on.

    (Or is it more accurate to say that they don't want to "do" all of the above?)

    None of that is WordPress' problem either. Thats called an uneducated, and dare I say, in most cases, lazy user.

    Being a decent web master takes more than a piece of a software, friend.

    Nice bump on a 5 month old post too. Apparantly, reading dates is too much to ask of the average WordPress user as well...

  12. coll
    Member
    Posted 7 years ago #

    I appear to be having similar problems. Is there an answer to this as yet.

  13. Inspired2Write
    Member
    Posted 7 years ago #

    Hi,
    I've had some challenges with the editor as well so I leave mine turned off. You might want to try it and see if you can post without bad codes creeping in.

    Go to: Dashboard > then select 'update your profile or password' from the left column > in 'your profile' scroll down to the bottom of the page, and on the left you will see 'personal options'. If the box next to the words, 'Use the visual rich editor when writing' is selected, uncheck the box to deactivate that option.

    Then try some posts and see if it fixes the problem. If so you can then go back and re-select it if you prefer, but if it won't post without inserting bad codes then go back to deactivate it. I hope that helps!

  14. Businessman
    Member
    Posted 7 years ago #

    Try the different settings on this plugin:
    http://dev.wp-plugins.org/wiki/TextControl

Topic Closed

This topic has been closed to new replies.

About this Topic