Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect core/embed block rendered property #26

Open
guillaumer opened this issue Sep 21, 2021 · 0 comments
Open

Incorrect core/embed block rendered property #26

guillaumer opened this issue Sep 21, 2021 · 0 comments

Comments

@guillaumer
Copy link

Version

Wordpress 5.8.1

Problem

Core/embed block rendered property is not consistent with the regular PHP output as WP_Embed class is not run on the content.

Expected rendered block content (PHP)

\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Ed Sheeran, Martin Garrix, Kygo, Dua Lipa, Avicii, The Chainsmokers Style - Feeling Me #78\" width=\"1333\" height=\"1000\" src=\"https://www.youtube.com/embed/ssYbrK0eRZw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>\n</div></figure>\n

API rendered block content

\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\nhttps://www.youtube.com/watch?v=ssYbrK0eRZw\n</div></figure>\

Proposed solution

Either run the_content filter, which might be anyway a good idea in order to get a rendered content as close as possible from the PHP rendering, or use:

global $wp_embed;
$block['rendered'] = $wp_embed->autoembed( $block['rendered'] );

Great job on the plugin, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant