Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: oembed_linktypes

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

Line Code
106       * @return bool|string False on failure, otherwise the oEmbed provider URL.
107       */
108      function discover( $url ) {
109           $providers = array();
110
111           // Fetch URL content
112           if ( $html = wp_remote_retrieve_body( wp_remote_get( $url ) ) ) {
113
114                // <link> types that contain oEmbed provider URLs
115                $linktypes = apply_filters( 'oembed_linktypes', array(
116                     'application/json+oembed' => 'json',
117                     'text/xml+oembed' => 'xml',
118                     'application/xml+oembed' => 'xml', // Incorrect, but used by at least Vimeo
119                ) );
120
121                // Strip <body>
122                $html = substr( $html, 0, stripos( $html, '</head>' ) );
123
124                // Do a quick check