• I’m trying to migrate an old hand-coded HTML site into a series of WordPress Posts on a new site. I created five Posts by logging into an Editor account, then copying and pasting the old pages into the standard WordPress rich-text editor; that mostly works well. However, some of the old HTML needs cleanup, and I’d like to edit it from within WordPress. When I go to the “admin” account to edit, the HTML editor doesn’t show all of the HTML code. At least, it doesn’t show the p and /p tags — and possibly other tags too. Here are details:

    I’m running WordPress 2.0.4. From the “admin” account under Users -> Your Profile, I’ve unchecked the bottom checkbox; this gives me the “classic” editor. When I open the Post I want to edit, I see code like this (between the dashed lines) in the browser window:

    ——–START OF EDITOR WINDOW EXCERPT
    <a name="something"></a>This is the first paragraph in the Post. Blah blah yadda yadda. Here is <a href="https://somewhere.com/">a link</a>.
    ---BLANK LINE HERE---
    <a name="another"></a>This is the second paragraph in the Post.

    ——–END OF EDITOR WINDOW EXCERPT

    The p and /p tags seem to be missing. But, if I open the Post in a Firefox window, then use the browser’s “View Source” command, I see code that includes the p and /p tags:

    ——–START OF “VIEW SOURCE” EXCERPT
    <p><a name="something"></a>This is the first paragraph in the Post. Blah blah yadda yadda. Here is <a href="https://somewhere.com/">a link</a>.</p>
    <p><a name="another"></a>This is the second paragraph in the Post.</p>

    ——–END OF “VIEW SOURCE” EXCERPT

    How can I see and edit all of the HTML code that’s sent to people who read the post? (I’m not talking about editing the Theme or the left/right margins, just the actual text of the Post.)

    Thanks,
    Jerry

Viewing 10 replies - 1 through 10 (of 10 total)
  • If you are copying HTML code – never use the wysiwyg (rich text) monster. Disable it.
    admin > Users > Your profile: bottom left.

    Thread Starter jerrypeek

    (@jerrypeek)

    Thanks for that tip, moshu.

    But I’m still wondering how to see all of the HTML that will be sent to the browser of someone who reads one of my Posts. It seems that the WP classic HTML editor may be “sanitizing” the HTML that it lets me edit. I’d at least like to know what rules it’s following when it does this. In case it helps, here are some specific questions:

    • What tags are “hidden” or added automatically in the text I see in the editor window?
    • If I type a blank line (press ENTER twice), does the editor replace that line with a /p tag followed by a p tag?
    • If I type a p tag or a /p tag, does the editor delete them, or could I end up with two p tags in a row (mine, plus one that the editor adds)?

    I want to understand how this editor works so I’ll be more sure that my HTML is what I intend it to be.

    I want to understand how this editor works

    Very badly. Poorly. Bottom line: DO NOT USE IT.

    Thread Starter jerrypeek

    (@jerrypeek)

    Sounds like good advice, moshu. I’ve got a big and busy site to port to WordPress, so the HTML needs to be right. Any advice about what to use instead of this editor? I’ve done lots of searching in the Codex and Support Forums, and found lots of people asking this same kind of question, but I haven’t found any other answers.

    The best for me would be if I could download that HTML code for the Post (the text that people read — not the Theme or other stuff) onto my local computer and edit it directly with the plain-text editor that I use for other HTML editing. I can use FTP, log into the server and use a shell (command line) to run MySQL commands, or whatever else. I don’t mind complicated steps if that’s what’s needed. Thanks again for any advice!

    I don’t understand complicated things. Sorry.
    What I do whenever I install a WP script:
    admin > Options > Writing: Users should use the visual rich editor by default – UNCHECK
    and
    admin > Users > Your profile: bottom left corner – UNCHECK.

    Your problems are gone. You can copy into the text area any “normal” (=valid) HTML code and it will work.
    What you will se is the “traditional” WP editor in which:
    1x Enter = br
    2x Enter = p (closing the previous and opening new one)
    if you have your own p tags (like when copying from an old html) – don’t have empty lines between them; it won’t add additional tags.
    i.e. copying
    <p>mytexthere</p>
    <p>mysecondparagraph</p>

    will work nicely – producing valid code!

    (all of the above happens via the magic of WP’s “autop” function I believe)

    Thread Starter jerrypeek

    (@jerrypeek)

    Thanks a lot! I’ll start working on this.

    Thread Starter jerrypeek

    (@jerrypeek)

    I’m still having trouble. It seems that, even if I don’t put ANY blank line, something is adding p tags around some of the code I insert. For instance, I’m trying to insert the HTML code to produce a Google Search box like the two in the body of https://www.googleguide.com/similar_pages.html. No matter what I do — even if I type all of the HTML on a single line with no line breaks — I still end up with garbage.

    HandySolo, I think you’re right about autop getting in the way. I’ve read the long post WordPress Editor Driving Me Insane. It sounds like the HTML stored in the database is modified by autop as the final page is being rendered.

    I’ve had some luck with the Mime Type Plugin. I installed it, then I wrote a Post in the “classic” WordPress editor with some HTML p and /p tags in the body. Underneath the editing window, I added a Custom Field with name mime_type and value text/html. When I saved the Post, opened it in a new browser window, and used the browser’s View Source command, I saw exactly the HTML I’d input — the same line breaks and everything. Excellent.

    Some HTML still seems to freeze the server, though. For instance, when I tried to “Save and Continue Editing” after adding an HTML FORM tag with method=GET, my browser’s spinner kept spinning — as if the server hasn’t finished serving the page — and I couldn’t load the page in other browser windows either. I’m not sure where the problem is, but I get the idea that WordPress just isn’t designed for serving arbitrary HTML.

    Thoughts, anyone? (Check out that Mime Type plugin, anyway!) Thanks…

    Jerry

    1x Enter = br
    2x Enter = p (closing the previous and opening new one)
    if you have your own p tags (like when copying from an old html) – don’t have empty lines between them; it won’t add additional tags.
    i.e. copying
    <p>mytexthere</p>
    <p>mysecondparagraph</p>
    will work nicely – producing valid code!

    I can’t get this to work. I’ve turned off the visual editor, which I never use anyway. I hand-code all my HTML in the simple textarea editor. But then WordPress “sanitizes” my HTML. The worst problem is that I can not add extra lines where I want. If I add in two open lines (in the textarea box), I expect to get a paragraph tag, but instead the two open lines get reduced to one.

    The only thing I’ve found that let’s me add in extra spacing lines is this:

    <p> </p>

    However, the next time I open this post to be edited, WordPress takes out all my extra P tags.

    Is there anyway to keep WordPress from destroying my HTML?

    You can see what I mean here:

    https://www.thesecondroad.org/tsr/2007/10/22/tsr-update-may-3-2007/

    No, WP will not let you add “infinite” number of blank lines.

    I don’t see your problem at the link provided.
    If you meant not having space between your paragraphs… you better learn to read your own stylesheet:

    #maincontent p {
    font-size: 12px;
    line-height: 21px;
    margin: 0px;
    padding: 0px;
    color: #545454;
    }

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WP “classic” HTML editor doesn’t show all HTML tags’ is closed to new replies.