[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
Mon Nov 5 16:53:21 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:  Awaiting Review
Component:  Editor        |    Version:  5.0
 Severity:  normal        |   Keywords:  dev-feedback needs-patch
  Focuses:                |
--------------------------+--------------------------------------
 In gutenberg/lib/compat.php is the following code:

 {{{
 /**
  * As a substitute for the default content `wpautop` filter, applies autop
  * behavior only for posts where content does not contain blocks.
  *
  * @param  string $content Post content.
  * @return string          Paragraph-converted text if non-block content.
  */
 function gutenberg_wpautop( $content ) {
         if ( has_blocks( $content ) ) {
                 return $content;
         }

         return wpautop( $content );
 }
 remove_filter( 'the_content', 'wpautop' );
 add_filter( 'the_content', 'gutenberg_wpautop', 6 );
 }}}

 The equivalent for this is not found in WordPress core.  Where I stumbled
 across this is in a plugin I'm integrating with Gutenberg, I have an html
 structure created from server side render (dynamic block) that is similar
 to this:

 {{{
 <li><img><span>Some text</span></li>
 }}}

 With ''just'' WordPress 5.0.beta.3 active the output in the post content
 on the frontend is:

 {{{
 <li><img><p><span>Some text</span></p></li>
 }}}

 With WordPress 5.0.beta.3 ''and'' the Gutenberg plugin active (latest
 master) I get this:

 {{{
 <li><img><span>Some text</span></li>
 }}}

 I'm willing to work on a patch for this, but I'm not sure if this is an
 intentional omission in WP 5.0 or not.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45290>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list