Ticket #5250 (new defect)

Opened 11 months ago

Last modified 8 months ago

wpautop() issue with nested lists

Reported by: Narc0tiq Assigned to: anonymous
Priority: normal Milestone: 2.9
Component: Template Version: 2.3
Severity: normal Keywords: xhtml autop needs-patch
Cc:

Description

First of all, my sincere apologies if this is a duplicate.

The problem, in short: WordPress inserted a number of unclosed <p> tags into my post. It should either insert correctly closed tags, or none at all. I honestly would prefer the former.

In detail: I had HTML code very similar to this:

<ul>

<li>text<ul>

<li>subtext</li>

</ul>more text</li>

</ul>

This was automatically converted to:

<ul>

<li>text<ul>

<li>subtext</li>

</ul><p>more text</li>

</ul>

Note the extra <p> tag in the above, which is unclosed (making the W3C validator choke on my website).

Also note, I was not using the WYSIWYG editor (turning it off was the first thing I did), so it's unlikely to be due to that.

As a workaround, manually inserting properly closed <p> tags works just fine:

<ul>

<li>text<ul>

<li>subtext</li>

</ul><p>more text</p></li>

</ul>

Since this workaround exists, the bug is not very prioritary, but it should also (hopefully) be easy to fix.

Change History

10/24/07 00:48:43 changed by Narc0tiq

  • milestone deleted.

10/24/07 03:58:53 changed by Otto42

  • keywords changed from xhtml to xhtml autop.
  • priority changed from low to normal.
  • severity changed from trivial to normal.
  • milestone set to 2.4.

10/24/07 04:25:19 changed by Viper007Bond

Another work around is just to add in some line breaks:

<ul>
	<li>Some text!
		<ul>
			<li>More text!</li>
		</ul>
	</li>
</ul>

10/24/07 07:57:34 changed by Viper007Bond

  • keywords changed from xhtml autop to needs-patch.
  • summary changed from Unclosed p tags -- not XHTML-compliant! to wpautop() issue with nested lists.

I take that back. I forgot the text after the first </ul> and even with more line breaks, it added in a <p>. My apologies.

10/24/07 15:33:56 changed by foolswisdom

  • keywords changed from needs-patch to xhtml autop needs-patch.

12/28/07 04:29:22 changed by darkdragon

  • component changed from General to Template.