Problems in the_content filter and wpautop()?
-
I tried to put a block element followed by some text in a list item. I thought the_content filter would generate a <p> element after the heading. And it did begin the paragraph, but it forgot to end it.
I think the problem is somewhere in wpautop(). Here are some tests I did:
echo wpautop("<ul><li><h2>Heading</h2></li></ul>"); // Correct output: <ul><li><h2>Heading</h2></li></ul> echo wpautop("<ul><li>Paragraph paragraph</li></ul>"); // Correct output?: <ul><li>Paragraph paragraph</li></ul> echo wpautop("<ul><li><h2>Heading</h2>Paragraph paragraph</li></ul>"); // STRANGE output: <ul><li><h2>Heading</h2><p>Paragraph paragraph</li></ul> echo wpautop("<ul><li><h2>Heading</h2>Paragraph paragraph\n</li></ul>"); // STRANGE output: <ul><li><h2>Heading</h2><p>Paragraph paragraph</li></ul> echo wpautop("<ul><li><h2>Heading</h2>Paragraph paragraph\r</li></ul>"); // STRANGE output: <ul><li><h2>Heading</h2><p>Paragraph paragraph</li></ul> echo wpautop("<ul><li><h2>Heading</h2>Paragraph paragraph\n\r</li></ul>"); // Correct output: <ul><li><h2>Heading</h2><p>Paragraph paragraph</p></li></ul> echo wpautop("<ul><li>Paragraph paragraph\n\rParagraph paragraph\n\r</li></ul>"); // STRANGE output: <ul><li>Paragraph paragraph</p><p>Paragraph paragraph</p></li></ul>
Is this normal behavior?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Problems in the_content filter and wpautop()?’ is closed to new replies.