wp_oembed_add_provider( string $format, string $provider, boolean $regex = false )
Adds a URL format and oEmbed provider URL pair.
Description Description
See also See also
Parameters Parameters
- $format
-
(string) (Required) The format of URL that this provider can handle. You can use asterisks as wildcards.
- $provider
-
(string) (Required) The URL to the oEmbed provider.
- $regex
-
(boolean) (Optional) Whether the
$formatparameter is in a RegEx format.Default value: false
Source Source
File: wp-includes/embed.php
function wp_oembed_add_provider( $format, $provider, $regex = false ) {
if ( did_action( 'plugins_loaded' ) ) {
$oembed = _wp_oembed_get_object();
$oembed->providers[ $format ] = array( $provider, $regex );
} else {
WP_oEmbed::_add_provider_early( $format, $provider, $regex );
}
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
Register a provider for any URL beginning in http://site.com/watchvideo/ using a simple wildcard URL format:
Note: Do not leave empty space, neither before nor after
YouTube
Register YouTube’s oEmbed provider for YouTube URLs using a regex URL format:
Note: YouTube is already registered by default with WordPress. This is merely an example, you do not need to register YouTube yourself.