[wp-meta] [Making WordPress.org] #5148: Theme Handbook: formatting issues on Child Themes page

Making WordPress.org noreply at wordpress.org
Wed Apr 15 17:33:54 UTC 2020


#5148: Theme Handbook: formatting issues on Child Themes page
-------------------------+---------------------
 Reporter:  argumentum0  |       Owner:  (none)
     Type:  defect       |      Status:  new
 Priority:  normal       |   Milestone:
Component:  Handbooks    |  Resolution:
 Keywords:               |
-------------------------+---------------------

Comment (by Otto42):

 Okay, here's what I got so far:

 In /themes/pub/wporg-developer/inc/head.php, on line 62:

 `$desc = apply_filters( 'the_content', $post->post_content, $post->ID );`

 If you comment out this line or change the post content to not be blocks,
 problem goes away. Obviously this is not desirable for the description.

 Problem seems to be coming from core, somehow. When calling this, there is
 the `do_blocks` function in core. This function is supposed to check if
 the content has blocks, and turn off the wpautop function appropriately.
 It appears to do this, and adds the hook for the `_restore_wpautop_hook`
 function to re-enable afterwards.

 This appears to work, in that the process goes off normally. However,
 then, for some reason I cannot work out, `_restore_wpautop_hook` gets
 called a second time. On this second run, this line:

 `$current_priority = has_filter( 'the_content', '_restore_wpautop_hook'
 );`

 Comes back false. There's no check for false here, since it doesn't make a
 lot of sense. So this line gets run:

 `add_filter( 'the_content', 'wpautop', $current_priority - 1 );`

 This then adds the wpautop filter with a -1 priority, which is lower than
 the normal do_blocks priority. So when the actual content runs on the page
 (not in the head), wpautop is enabled for it, and it is what is adding the
 errant P blocks.

 I have no idea why `_restore_wpautop_hook` is running twice. Can't find
 it. But this is where the error lies.

 cc @dd32

-- 
Ticket URL: <https://meta.trac.wordpress.org/ticket/5148#comment:6>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list