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