WordPress.org

Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#48034 new defect (bug)

Video embeds fail if embed block is converted to a reusable block.

Reported by: donmhico Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Embeds Keywords: has-patch
Focuses: Cc:
PR Number:

Description

This issue is from Gutenberg's GitHub repo -

I'll just copy the main issue here - https://github.com/WordPress/gutenberg/issues/4483

Credits to niranjan-uma-shankar for raising the issue.

Embedding youtube videos works well. However, if you convert the block to a reusable block, the youtube player no longer gets embedded in the post. In the editor, the embed continues to show the player, though the play button doesn't work anymore.

Attachments (1)

48034.diff (575 bytes) - added by donmhico 5 weeks ago.

Download all attachments as: .zip

Change History (2)

@donmhico
5 weeks ago

#1 @donmhico
5 weeks ago

  • Keywords has-patch added

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, 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.

Note: See TracTickets for help on using tickets.