Use Auto Embed with get_post()

You need to set the global $post object to your post. This is done by the loop functions in your theme which is why it works there. WP’s oEmbed replaces the URLs during the the_content filter. But it replaces the URLs through two means. The first is a simple regex find and replace for certain … Read more

add oembed provider

The easiest way would be to take advantage of Embedly’s outstanding API. Add this code to your theme’s functions.php: // Add Myvideo oEmbed function add_oembed_myvideo(){ wp_oembed_add_provider( ‘http://www.myvideo.ge/*’, ‘http://api.embed.ly/v1/api/oembed’ ); } add_action(‘init’, ‘add_oembed_myvideo’); Embedly is free up to 5,000 “unique URLs per hour per month”. Unless you’re going wild with embeds on your site, you’ll probably … Read more

Getting results from wp_oembed_add_provider

Ok I managed to solve this! Did some digging through how the embed system works, and it turns out it wasn’t the use of wp_oembed_add_provider() that was wrong. Debugging autoembed_callback() in wp-includes\class-wp-embed.php showed that my YouTube URL was coming through but my Facebook URL never made it to this function. Echo’ing the post content before … Read more

WordPress 5.3.x YouTube oEmbed is not working

So apparently the issue also happens in WordPress 5.6 (the latest release as of writing), and YouTube is probably at fault because the (oEmbed) <link> tags are in the body instead of the head (see screenshot below), and that in turn causes the issue because WP_oEmbed::discover() looks for the <link> tags in the head only. … Read more

Add parameters vimeo videos using wordpress embeds

There are several filters in WordPress for altering oEmbed data, depending on when you need to modify the results: embed_handler_html Filters the returned embed handler. embed_oembed_html Filters the cached oEmbed HTML. oembed_result Filters the HTML returned by the oEmbed provider. Choose the one that best suits your needs, but keep in mind that each filter … Read more