[wp-trac] [WordPress Trac] #28607: Make wpautop()'s $allblocks variable filterable
WordPress Trac
noreply at wordpress.org
Mon Jun 23 10:39:17 UTC 2014
#28607: Make wpautop()'s $allblocks variable filterable
---------------------------+---------------------------------------
Reporter: walkinonwat3r | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: administration, template
---------------------------+---------------------------------------
Comment (by walkinonwat3r):
I can see sense in renaming $allblocks, as I'm not sure that accurately
describes the purpose of the variable. Something along the lines of
$exclude_from_paragraph_wrap might be a closer to what it's doing here.
The filter could also pass an array of HTML tag names, which would allow
for easier unset() and conditionals. (Then implode the array to form the
regex string.)
Is there something in the HTML spec that says non-block elements should be
wrapped in paragraph tags? If not, then I think that makes the list in
$allblock a bit of an arbitrary setting, ''especially'' in an HTML5
context.
Removing the tags after the fact isn't simple. You could regex them out...
but then you have to account for links around images, bad HTML, and other
possible edge cases. I've also always read that you shouldn't use regex on
HTML. I suppose you could hook into the_content and fire up DOMDocument
every time, but that seems like overkill (and overhead) when the tags can
be prevented from being added in the first place.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28607#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list