add_filter is failing to append &rel=0 to end of YouTube URL in oEmbed
add_filter is failing to append &rel=0 to end of YouTube URL in oEmbed
add_filter is failing to append &rel=0 to end of YouTube URL in oEmbed
Not allowing my site to be embedded elsewhere via oEmbed
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
It doesn’t, that’s not how oEmbed works. WordPress doesn’t generate or format the HTML for an OEmbed, the OEmbed provider is responsible for that. It’s not even responsible for the creation of the iframe tag. The most WordPress can do is suggest a maximum height and width, but it’s nothing more than a suggestion. So … Read more
Some hosts will use a page cache for API routes to deal with this kind of problem. My initial thought would be to look at something like Cloudflare (they have some WordPress presets too) that would allow you to set up this kind of page cache for these API routes. Interested to know how you … Read more
Completely disable oEmbed and auto-embed on frontend and post editor?
It’s a missing configuration on the apache hosts file which cause troubles on serveur ‘self call’. For exemple, if serveur is using domain.com, I’ve a timeout when I typing curl domain.com with shh. Adding 127.0.0.1 domain.com in /etc/hosts file and it’s work !
Maybe you can apply some content filters to ensure oEmbed will work. I applyed a simple regex in one of my themes because I know of some plugins that can break the oEmbed support. This can also work for you.
<?php if (strstr($audio, ‘<iframe’)) { echo $audio; } else { echo wp_oembed_get( get_post_meta($post->ID, ‘_format_audio_embed’, true) ); } ?> Of course, this would require that you get the custom field with the audio embed code or url into $audio 🙂 Edit – try: <?php $audio = get_post_meta($post->ID, ‘_format_audio_embed’, true); if (strstr($audio, ‘<iframe’)) { echo $audio; } … Read more
Conditionally enable autoplay when using oEmbed in a custom widget