I have some HTML comments in the post.
When rendered, the comments are enclosed into a paragraph with an additional line break like:
<p><!--mycomment!--><br /></p>
Is it WordPress or some plugin that does so? How to disable this beahviour?
I have some HTML comments in the post.
When rendered, the comments are enclosed into a paragraph with an additional line break like:
<p><!--mycomment!--><br /></p>
Is it WordPress or some plugin that does so? How to disable this beahviour?
Doesn't do it in HTML mode on my installs...
If you're writing that in visual mode then the text is parsed as literal text and not code, so naturally it will be given a paragraph and linebreak.
Actually the content is typed in HTML mode. There are no signs of HTML comments in visual mode....maybe a bug? Or a faulty plugin?
Try this in HTML mode (the code in the following message)
<!--pagetitle!-->
<!--beginspoiler!-->
<div class="jumps">In a rush?
Jump to <a href="somelinkhere">the solution in a nutshell!</a></div>
<!--endspoiler!-->
Try the code above in a post
Yes i see the problem... and i've been toying in HTML mode a little to get an idea of the issue.
Tested....
Test post 1:
<p> test</p>
test
<span>test</span>
<!--test-->
Result 1:
<p> test</p>
<p>test<br />
<span>test</span><br />
<!--test--></p>
Test post 2:
<div>
<p> test</p>
test
<span>test</span>
<!--test-->
</div>
Result 2:
<div>
<p> test</p>
<p>test<br />
<span>test</span><br />
<!--test-->
</p></div>
Test post 3:
<div>
<p>test</p>
<p>test</p>
<span>test</span>
<!--test-->
</div>
Result 3:
<div>
<p>test</p>
<p>test</p>
<p><span>test</span><br />
<!--test-->
</p></div>
Seems to me the issue depends on what elements are present and how they are nested. I hope the above helps...
Thanks for the in-depth test!
I'll do some testing too.
Thanks again
I have the same problem.
When adding <span></span>
It outputs
<p>
<span></span>
</p>
As per: folkspants.com/wordpress/theming/remove-paragraph-tags-from-your-wordpress-posts-so-your-media-stays-put
Comment out line 110 of wp-includes/default-filters.php :
add_filter( 'the_content', 'wpautop' );
This topic has been closed to new replies.