[wp-trac] [WordPress Trac] #45290: The equivalent of `gutenberg_wpautop` from Gutenberg plugin is missing in the 5.0 beta
WordPress Trac
noreply at wordpress.org
Tue Nov 6 13:12:06 UTC 2018
#45290: The equivalent of `gutenberg_wpautop` from Gutenberg plugin is missing in
the 5.0 beta
--------------------------------------+---------------------
Reporter: nerrad | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.0
Component: Editor | Version: 5.0
Severity: normal | Resolution:
Keywords: dev-feedback needs-patch | Focuses:
--------------------------------------+---------------------
Comment (by nerrad):
So ya I see:
{{{
// We don't need to autop posts with blocks in them.
if ( has_blocks( $pee ) ) {
return $pee;
}
}}}
Howwever `wpautop` is hooked into `the_content` on priority 10, and
`do_blocks` is hooked in on priority 9. So that means the blocks have
been parsed and the block serialized comments removed before hitting
`wpautop`. Thus the `has_blocks` check here is never going to be true.
The implementation in core differs from what was in the gutenberg plugin
because `wpautop` was re-registered running at priority 6 ''before'' the
blocks were parsed from content.
So the quick fix here is to just have `wpautop` run before block parsing.
In the attached patch I've set the priority of wpautop to 8 so it runs
just before `do_blocks` which is at priority 9. I've verified this
resolves the issue reported in this ticket but I'm not sure if there are
other side-effects to having wpautop run at a lower priority.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45290#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list