Skip to main content
10 votes
Accepted

how to escape wp_oembed_get for phpcs

Note that the WPCS standards for PHPCS are not "official". I am one of the maintainers, and all that we can do is to do our best to match the standards that WordPress suggests. In this case, I'm ...
J.D.'s user avatar
  • 3,915
7 votes
Accepted

What are the Oembed Links For?

Those are links for the wordpress "self" oEmbed. It provides the URLs needed to enable embeding the content of the wordpress site in other sites and they are resuired for oEmbed Discover You are ...
Mark Kaplun's user avatar
  • 23.4k
7 votes
Accepted

Add wrapper to only youtube videos via embed_oembed_html filter function

$url will contain the full URL to the embed source. E.g.: https://www.youtube.com/watch?v=_UmOY6ek_Y4, so you have to search within $url to see if the provider's name appears: add_filter( '...
Dave Romsey's user avatar
  • 17.8k
6 votes
Accepted

Remove frameborder attribute from iframes

WordPress doesn't add the frameborder attribute. YouTube does. It's part of their embed code. If you absolutely must remove it you can use the embed_oembed_html filter to modify the returned HTML: ...
Jacob Peattie's user avatar
4 votes
Accepted

Hiding Comments Icon On oembed

Pretty sure you can just remove them entirely: remove_action( 'embed_content_meta', 'print_embed_comments_button' );
TheDeadMedic's user avatar
  • 36.4k
4 votes

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 ...
rjb's user avatar
  • 1,387
3 votes
Accepted

Can I use wp_oembed_get to detect a valid embeddable link or is there a better way to do so?

The regex patterns for matching embeddable URLs are stored in WP_oEmbed, which has the method get_provider() for checking if a given URL is an embeddable URL for a supported provider. Just set the ...
Jacob Peattie's user avatar
3 votes
Accepted

How to check If Oembed is empty or not

The wp_oembed_get() only works for supported oEmbed providers. The return value is also is a URL of false, as mentioned per codex: If $url is a valid url to a supported provider, the function ...
Johansson's user avatar
  • 15.3k
3 votes
Accepted

Filter oembeds tags to modify iframe attributes

I was able to solve the the CORS issue by using this snippet which now allows this iFrame to allow-same-origin or runs scripts inside this domain. function oembed_iframe_overrides($html, $url, $attr) ...
Carl Alberto's user avatar
  • 1,077
3 votes
Accepted

Disable oEmbed for a Single Shortcode or at Least All Internal Links

Here we consider the question: can post embeds be disabled for all the internal links on a site currently running WordPress 4.5.3? The Short Story If we want to disable post embedding of internal ...
birgire's user avatar
  • 67.4k
3 votes

WordPress, oEmbed & YouTube video's with a 'dash'

Turns out the YouTube video in question had Embedding disabled by request. Tested with other YouTube videos with a 'dash' and they work fine (if embedding is not disabled).
David Clough's user avatar
3 votes

WP Oembed not passing through the "autoplay=1" variable

Cross-posting my answer from https://stackoverflow.com/a/55053642/799327, hope that's okay since it's from the same OP: So, after some research on this, the best way to do this is to leverage the ...
Laust Deleuran's user avatar
3 votes
Accepted

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-...
Tim Malone's user avatar
  • 4,754
2 votes
Accepted

wp_embed_register_handler is not working

You are trying to match the r2jeim68kuq6.html part, but you're not allowing dots in your regex pattern here: '#https://vidoza\.net/([a-zA-Z0-9_-]+)$#i' You can try e.g. (removing the A-Z too because ...
birgire's user avatar
  • 67.4k
2 votes
Accepted

Instagram URL is converted into oEmbed

Figured it out. Embed shortcode stores the oemebd data as post meta using md5 hash. wp-includes/class-wp-embed.php // Check for a cached result (stored in the post meta) $key_suffix = md5( $url . ...
Manoj H L's user avatar
  • 135
2 votes
Accepted

wp_embed_register_handler to embed html files

Fixing the regex pattern To match an url of the type: https://coptic-treasures.com/ {Some string with a mix of a-z letters and hyphen}/{Some number}.html like this example: https://coptic-...
birgire's user avatar
  • 67.4k
2 votes
Accepted

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 (...
Sally CJ's user avatar
  • 39.3k
2 votes

oembed_cache SPAM problem

Thank you so much for your reply. It helped me figure out what's going on. I get a far bit of spam submissions via my contact form, these spam submissions include URLs. Although they are being flagged ...
Medium_D's user avatar
1 vote
Accepted

Applying an oEmbed filter to a custom post type

After looking at the code reference for wp_oembed_get (and WP_oEmbed::get_html()) I don't think embed_oembed_html fitler gets fired when that function is called. But I might have missed something. ...
Antti Koskinen's user avatar
1 vote
Accepted

Combine embed_oembed_html and oembed_result

This works, just don't know if it's the proper way to do it: Yes, the functions are the same so they're equivalent. There is nothing wrong here. But if we dig a bit deeper, we see they're not 2 ...
Tom J Nowell's user avatar
  • 59.6k
1 vote

oEmbed 404 errors when trying to use embed block

Answering my own question... I figured it would be something simple. I had assumed that the videos I was trying to embed had 'allow embedding' activated. They didn't. When you edit the video in ...
protohominid's user avatar
1 vote

Advanced Custom Fields oembed only outputs YouTube URL

Such happens when video is not publicly accessible. In my case the video was simply removed from YouTube by their author and ACF's oEmbed module was unable to get metadata to properly display video.
Roman Nazarkin's user avatar
1 vote

How to make enqueue_embed_scripts work with the embed_template filter

It turns out that I just overlooked adding the do_action( 'embed_head' ) and do_action( 'embed_footer' ) in the template file that I have. Teehee!
Jeda Dragon's user avatar
1 vote

How to check If Oembed is empty or not

It’s a little hard to guess what’s your question really is and what exactly you want to check... If you want to check if $embed is empty, just check it: if ( ! trim($embed) ) { // it’s empty } ...
Krzysiek Dróżdż's user avatar
1 vote
Accepted

Add field to dashboard to update embedded URL on homepage?

Add the below code in the functions.php file and it will create a text field in the general setting options page add_action('admin_init', 'embed_url_initialize'); function embed_url_initialize() { ...
Lovin Nagi's user avatar
1 vote
Accepted

Checkbox on a meta box using CMB2 Plugin

If i get it right, then you just need to get that value from post meta, and make condition. $image_or_video = get_post_meta($post_id, $prefix . 'image_or_video', true); // Option 2 is selected if( '...
PayteR's user avatar
  • 206
1 vote
Accepted

Responsive embed for the video shortcode

You could create a new callback for the embed_oembed_html filter and target the third input argument, the oembed $url. Then you could e.g. create boolean helper functions like (untested): function ...
birgire's user avatar
  • 67.4k
1 vote

How to disable YouTube (and any other oembed) embeding in the editor

The quick way to disable oEmbeds would be add_filter( 'pre_oembed_result', '__return_false' ); If you want to disable it for all external links then try: /** * Disable oEmbeds for external links ...
birgire's user avatar
  • 67.4k
1 vote

Removing WordPress Icon from oembed link footer

Here's the code to remove the site icon markup from embeds: add_filter('get_site_icon_url','__return_false', 10, 3); If you want to remove the entire site-icon + site-title then use this: ...
Shivanand Sharma's user avatar
1 vote

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.
TheDeadMedic's user avatar
  • 36.4k

Only top scored, non community-wiki answers of a minimum length are eligible