Codex tools: Log in
Contents |
Registers an oEmbed provider with WordPress and adds it to the whitelist, allowing all users who can write posts to use this provider. See the Embeds document for more details.
This function should be called from a plugin or a theme's functions.php file.
<?php wp_oembed_add_provider( $format, $provider, $regex ); ?>
Register a provider for any URL beginning in http://site.com/watchvideo/ using a simple wildcard URL format:
<?php wp_oembed_add_provider( 'http://site.com/watchvideo/*', 'http://site.com/oembedprovider' ); ?>
Register YouTube's oEmbed provider for YouTube URLs using a regex URL format:
<?php wp_oembed_add_provider( '#http://(www\.)?youtube\.com/watch.*#i', 'http://www.youtube.com/oembed', true ); ?>
Note that YouTube is already registered by default with WordPress. This is merely an example, you do not need to register YouTube yourself.
Since: 2.9.0
wp_oembed_add_provider() is located in wp-includes/media.php.