[wp-trac] [WordPress Trac] #48034: Video embeds fail if embed block is converted to a reusable block.

WordPress Trac noreply at wordpress.org
Fri Sep 13 13:44:18 UTC 2019


#48034: Video embeds fail if embed block is converted to a reusable block.
--------------------------+------------------------------
 Reporter:  donmhico      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Embeds        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Changes (by donmhico):

 * keywords:   => has-patch


Comment:

 The issue seems to be caused by the mis-order of when re-usable blocks are
 parsed.
 `<!-- wp:block {"ref":XXX} /-->` - which handles reusable blocks are
 parsed during `do_block()`. But at this time the filter that gets the
 autoembed meta is already finished and will no longer be called.

 https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes
 /class-wp-embed.php#L39
 https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes
 /default-filters.php#L172

 The solution in the attached patch,
 [https://core.trac.wordpress.org/attachment/ticket/48034/48034.diff
 48034.diff], is to invoke `do_block()` earlier so that `<!-- wp:block
 {"ref":XXX} /-->` is already converted to the actual block content before
 it is passed to the autoembed filter.

 I'm not entirely sure though if this will cause any backward compatibility
 issue. Feedback and more tests are highly appreciated.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48034#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list