WordPress.org

Make WordPress Core

Changeset 28815


Ignore:
Timestamp:
06/24/2014 12:27:55 AM (4 years ago)
Author:
wonderboymusic
Message:

Add a filter/docs: 'oembed_remote_get_args' to WP_oEmbed->discover() and ->_fetch_with_format().

Props leewillis77, DrewAPicture.
Fixes #23442.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-oembed.php

    r28790 r28815  
    172172        $providers = array();
    173173
     174        /**
     175         * Filter oEmbed remote get arguments.
     176         *
     177         * @since 4.0.0
     178         *
     179         * @see WP_Http::request()
     180         *
     181         * @param array  $args oEmbed remote get arguments.
     182         * @param string $url  URL to be inspected.
     183         */
     184        $args = apply_filters( 'oembed_remote_get_args', array(), $url );
     185
    174186        // Fetch URL content
    175         $request = wp_safe_remote_get( $url );
     187        $request = wp_safe_remote_get( $url, $args );
    176188        if ( $html = wp_remote_retrieve_body( $request ) ) {
    177189
     
    273285    private function _fetch_with_format( $provider_url_with_args, $format ) {
    274286        $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
    275         $response = wp_safe_remote_get( $provider_url_with_args );
     287
     288        /** This filter is documented in wp-includes/class-oembed.php */
     289        $args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
     290
     291        $response = wp_safe_remote_get( $provider_url_with_args, $args );
    276292        if ( 501 == wp_remote_retrieve_response_code( $response ) )
    277293            return new WP_Error( 'not-implemented' );
Note: See TracChangeset for help on using the changeset viewer.