alleyinteractive / wp-block-converter

Convert HTML into Gutenberg Blocks with PHP
GNU General Public License v2.0
40 stars 2 forks source link

Issue-12: Add oEmbed support #14

Closed mogmarsh closed 8 months ago

mogmarsh commented 8 months ago

Description

I would like to see urls for oEmbeddable content be converted into the wp:embed block

Use Case

If a url such as https://www.instagram.com/p/CSpmSvAphdf/ is found, it will be converted into

<!-- wp:embed {"url":"https://www.instagram.com/p/CSpmSvAphdf/","type":"rich","providerNameSlug":"instagram","responsive":true} -->
<figure class="wp-block-embed is-type-rich is-provider-instagram wp-block-embed-instagram"><div class="wp-block-embed__wrapper">
https://www.instagram.com/p/CSpmSvAphdf/
</div></figure>
<!-- /wp:embed -->

wp_oembed_get should be useful to see if a url is oEmbeddable.