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