Dangling Paragraph Tag in Comments Fixed
-
I’ve figured out where the bug is that creates the hanging
</p>
tag in the comments.If you go to line 65 of the
functions-formatting.php
, located at “wp-includes/functions-formatting.php” you’ll see a line that reads:$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
This creates:
<p>Hello, my name is Hal.</p>
<p>You've found my blog.
</p>The third
\n
(newline) is what is creating the problem. If you take it out, your final</p>
tag will appear inline with your final sentence. It should read:$pee = preg_replace('/\n?(.+?)(?:\n\s*|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
The text will now appear as:
<p>Hello, my name is Hal.</p>
<p>You've found my blog.</p>For added styling, you can aline the final
<p>
with the rest of your markup by adding three (or however many you need) tabs (\t
) after the final newline (\n
) in line 65. It should look like this:$pee = preg_replace('/\n?(.+?)(?:\n\s*|\z)/s', "<p>$1</p>\n\t\t\t", $pee); // make paragraphs, including one at the end
- The topic ‘Dangling Paragraph Tag in Comments Fixed’ is closed to new replies.