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