• WordPress appears to be auto-inserting <p> tags into my posts and not closing them. I have checked the code in the “code” view in TinyMCE, and the tags do not appear. I have turned off “Visual Editing” in my profile, checked, no unclosed <p> tags where they are not supposed to be. However, when I run the page (via URL) thru the W3 validator or view the source code of the fully generated page, the unclosed <p> tags appear in the post.

    The problem this is causing is that it is breaking the page. What is worse is that I cannot fix the issue aside from completely rewriting the posts from scratch.

    I have even gone as far as checking the code for the posts within the database itself and even in the data base the <p> tags do NOT show up.

    I do not have an plugins that do code editing like that, and it only started happening when I went back and edited a post, which right after I submitted the edits broken the page design. I knew something was wrong because the sidebar for my site vanished.

    I first thought it was some auto-completion thing with TinyMCE, but since the weird code changes don’t show up in the database, I figure it may not be TinyMCE.

Viewing 6 replies - 1 through 6 (of 6 total)
  • there isnt a single question mark in that post. Just like this one.

    Depending on where the unclosed <p> tags appear this may be a stupid question, but might it be your single.php theme file?

    Thread Starter macharborguy

    (@macharborguy)

    The <p> tags are appearing “within” the post content. So anything that would be printed via the the_content() function is getting this odd treatment.

    Here is the way the code shows up in the visual WordPress editor, even when “use visual editor” is turned off in my profile, AND this is how the raw data appears in the database when I look in the table wp_posts…

    <div class="banner-block">
    <h1 style="text-align: left;">News Post Originally Appeared On...</h1>
    <a href="http://feeds.feedburner.com/gamertell?format=xml" target="_blank">
    <img src="http://www.thegeekmedia.com/assets/img/banners/blogs/1.jpg" alt="" width="225px" height="50px" />
    </a></div>

    The above is valid and is how it is supposed to look. Below, however, is how it shows up in the View Source of a web browser and how the W3 Validator is reading it.

    <div class="banner-block">
    <h1 style="text-align: left;">News Post Originally Appeared On...</h1>
    <a href="http://feeds.feedburner.com/gamertell?format=xml" target="_blank">
    
    <img src="http://www.thegeekmedia.com/assets/img/banners/blogs/1.jpg" alt="" width="225px" height="50px" />
    </a></div>

    Now this is only a snippet of the code, but it is also where the invalidations start. The <p> tags get inserted for no reason and on top of that are not even closed properly.

    Now, as for my question which I felt what quite obvious: How do I stop WordPress from inserting these tags?

    Your two code examples look exactly the same to me.

    I’d recommend redesigning your theme so that you are not inefficiently having to paste the above banner code into every post. Otherwise if you don’t want paragraphs or line breaks inside pasted code, a way to help prevent it is to have your pasted code all on one line (no line breaks in your code).

    Thread Starter macharborguy

    (@macharborguy)

    sorry, i see what happened with the above code post. here is what should have appeared in the code block…

    <div class="banner-block">
    <h1 style="text-align: left;">News Post Originally Appeared On...</h1>
    <p><a href="http://feeds.feedburner.com/gamertell?format=xml" target="_blank">
    <p> </p>
    <p><img src="http://www.thegeekmedia.com/assets/img/banners/blogs/1.jpg" alt="" width="225px" height="50px" />
    </a></div>

    The banner gets added to each of my posts via the WP-O-Matic plugin for pulling content from blogs that are affiliated with my own blog/website. When WP-O-Matic initially generates the post, everything appears fine and dandy. It is if I go into the post via the WordPress editor that everything goes wonky and all of these rogue <p> tags get tossed in for seemingly no reason.

    It may be an issue with how the plugin works. Try making your auto-inserted code all on one line.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WordPress Auto-Inserting <p> tags’ is closed to new replies.