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
441            * Filters oEmbed remote get arguments.
442            *
443            * @since 4.0.0
444            *
445            * @see WP_Http::request()
446            *
447            * @param array  $args oEmbed remote get arguments.
448            * @param string $url  URL to be inspected.
449            */
450           $args = apply_filters( 'oembed_remote_get_args', $args, $url );
451
452           // Fetch URL content.
453           $request = wp_safe_remote_get( $url, $args );
454           $html    = wp_remote_retrieve_body( $request );
455           if ( $html ) {
456
457                /**
458                 * Filters the link types that contain oEmbed provider URLs.
459                 *
 
Line Code
562       *
563       * @param string $provider_url_with_args URL to the provider with full arguments list (url, maxheight, etc.)
564       * @param string $format                 Format to use.
565       * @return object|false|WP_Error The result in the form of an object on success, false on failure.
566       */
567      private function _fetch_with_format( $provider_url_with_args, $format ) {
568           $provider_url_with_args = add_query_arg( 'format', $format, $provider_url_with_args );
569
570           /** This filter is documented in wp-includes/class-wp-oembed.php */
571           $args = apply_filters( 'oembed_remote_get_args', array(), $provider_url_with_args );
572
573           $response = wp_safe_remote_get( $provider_url_with_args, $args );
574           if ( 501 == wp_remote_retrieve_response_code( $response ) ) {
575                return new WP_Error( 'not-implemented' );
576           }
577           $body = wp_remote_retrieve_body( $response );
578           if ( ! $body ) {
579                return false;
580           }