Making wp-block-embed-youtube responsive

Halfway through writing my own CSS to make WordPress’ Youtube embeds do responsive resizing, I found out that WordPress can do it for you. You just need to put this line into functions.php:

add_theme_support( 'responsive-embeds' );

Fixed. Now when you paste a Youtube URL into the block editor (Gutenberg), WordPress will make it look right with no further messing around needed.

(Though I do wonder: why isn’t this just done by default? The block editor brings in its own CSS to do columns and such – responsive embeds should be in there too.)

Leave a Reply

Your email address will not be published. Required fields are marked *