wp_oembed_add_provider

Adds a URL format and oEmbed provider URL pair.

Description

wp_oembed_add_provider( (string) $format, (string) $provider, (bool) $regex = false ); 

Parameters (3)

0. $format (string)
The format of URL that this provider can handle. You can use asterisks as wildcards.
1. $provider (string)
The URL to the oEmbed provider.
2. $regex — Optional. (bool) => false
Whether the $format parameter is in a RegEx format. Default false.

Usage

  1. if ( !function_exists( 'wp_oembed_add_provider' ) ) { 
  2. require_once ABSPATH . WPINC . '/embed.php'; 
  3.  
  4. // The format of URL that this provider can handle. You can use asterisks 
  5. // as wildcards. 
  6. $format = ''; 
  7.  
  8. // The URL to the oEmbed provider. 
  9. $provider = ''; 
  10.  
  11. // Optional. Whether the `$format` parameter is in a RegEx format. Default false. 
  12. $regex = false; 
  13.  
  14. // NOTICE! Understand what this does before running. 
  15. $result = wp_oembed_add_provider($format, $provider, $regex); 
  16.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/embed.php  
  1. function wp_oembed_add_provider( $format, $provider, $regex = false ) { 
  2. if ( did_action( 'plugins_loaded' ) ) { 
  3. $oembed = _wp_oembed_get_object(); 
  4. $oembed->providers[$format] = array( $provider, $regex ); 
  5. } else { 
  6. WP_oEmbed::_add_provider_early( $format, $provider, $regex );