Avoid embedding YouTube videos and open them in a new window

How about this shortcode: function alternative_youtube_embed_func( $atts ) { $a = shortcode_atts( array( ‘id’ => ‘ScMzIvxBSi4’ // youtube video ID from video URL ), $atts); return ‘<a href=”https://www.youtube.com/watch?v=’ . $a[“id”] . ‘” rel=”noopener noreferrer” target=”_blank”><img width=”560″ height=”315″ src=”https://img.youtube.com/vi/’ . $a[“id”] . ‘/0.jpg” alt=”link to youtube video” /></a>’; } add_shortcode( ‘alternative-youtube-embed’, ‘alternative_youtube_embed_func’ ); Add a play-button … Read more

Wrap iframes/embeds, but do it before oEmbed happens

WordPress embed the URLs on same filter with priority of 8 in /wp-includes/class-wp-embed.php // Attempts to embed all URLs in a post add_filter( ‘the_content’, array( $this, ‘autoembed’ ), 8 ); and you are parsing content after it with priority of 10 then defiantly you will get the parsed output. You just need to do it … Read more

class-oembed Error

The function _wp_oembed_get_object was moved from class-oembed.php to embed.php a while back – your best bet is to reinstall WordPress.

Use oEmbed for static html

oEmbed means in reality an iframe being added to the page. As such you do not need any oembed and you can just “include” your html page as an iframe while editing the page (assumin you are an admin). Note: as @Milo said in the comments, you most likely ask for the wrong solution, the … Read more

What are available arguments for wp_oembed_get?

The whole idea of embedding is that you do not have control over how the embedded content is being styled and it is controlled by the server from which the content is embedded. The embedding server might allow some control over the embedded content via the URL parameters but to know how to achieve that … Read more

WordPress kills an iframe’s apostrophes

The apostrophs get translated in &#39; For the apostrophs, I guess it is an xss security feature. Check settings > reading > encoding (UTF8) But im not sure (maybe the theme sets another encoding fixed in the header instead of reading the global variable). In any case your embed show correct in my WP test … Read more