WordPress.org

Make WordPress Core

Ticket #16327: 16327.001.patch

File 16327.001.patch, 1.0 KB (added by r-a-y, 7 years ago)
  • wp-includes/media.php

     
    14051405        require_once( ABSPATH . WPINC . '/class-oembed.php' );
    14061406        $oembed = _wp_oembed_get_object();
    14071407        $oembed->providers[$format] = array( $provider, $regex );
     1408}
     1409
     1410/**
     1411 * Removes a URL format and oEmbed provider URL pair.
     1412 *
     1413 * @since 3.1
     1414 * @see WP_oEmbed
     1415 *
     1416 * @uses _wp_oembed_get_object()
     1417 *
     1418 * @param string $match The URL format for the oEmbed provider.  Can input an exact match for the format or just a portion. eg. 'youtube'.
     1419 * @param string $provider The URL to the oEmbed provider.  Must be exact match.
     1420 */
     1421function wp_oembed_remove_provider( $match, $provider ) {
     1422        require_once( ABSPATH . WPINC . '/class-oembed.php' );
     1423        $oembed = _wp_oembed_get_object();
     1424
     1425        foreach ( $oembed->providers as $format => $param ) {
     1426                if ( strpos( $format, $match ) !== false && $param[0] == $provider ) {
     1427                        unset( $oembed->providers[$format] );
     1428                        break;
     1429                }
     1430        }
    14081431}
     1432 No newline at end of file