Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: oembed_remote_get_args

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
303            * Filter oEmbed remote get arguments.
304            *
305            * @since 4.0.0
306            *
307            * @see WP_Http::request()
308            *
309            * @param array  $args oEmbed remote get arguments.
310            * @param string $url  URL to be inspected.
311            */
312           $args = apply_filters( 'oembed_remote_get_args', array(), $url );
313
314           // Fetch URL content
315           $request = wp_safe_remote_get( $url, $args );
316           if ( $html = wp_remote_retrieve_body( $request ) ) {
317
318                /**
319                 * Filter the link types that contain oEmbed provider URLs.
320                 *
321                 * @since 2.9.0
 
Line Code
408       * @access private
409       * @param string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
410       * @param string $format Format to use
411       * @return bool|object False on failure, otherwise the result in the form of an object.
412       */
413      private function _fetch_with_format( $provider_url_with_args, $format ) {
414           $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
415
416           /** This filter is documented in wp-includes/class-oembed.php */
417           $args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
418
419           $response = wp_safe_remote_get( $provider_url_with_args, $args );
420           if ( 501 == wp_remote_retrieve_response_code( $response ) )
421                return new WP_Error( 'not-implemented' );
422           if ( ! $body = wp_remote_retrieve_body( $response ) )
423                return false;
424           $parse_method = "_parse_$format";
425           return $this->$parse_method( $body );
426      }