WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Auto-Inserting <p> tags (7 posts)

  1. macharborguy
    Member
    Posted 5 years ago #

    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.

  2. whooami
    Member
    Posted 5 years ago #

    there isnt a single question mark in that post. Just like this one.

  3. Technokinetics
    Member
    Posted 5 years ago #

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

  4. macharborguy
    Member
    Posted 5 years ago #

    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?

  5. iridiax
    Member
    Posted 5 years ago #

    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).

  6. macharborguy
    Member
    Posted 5 years ago #

    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.

  7. iridiax
    Member
    Posted 5 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic