Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: embed_oembed_html

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
188                           * Filter the cached oEmbed HTML.
189                           *
190                           * @since 2.9.0
191                           *
192                           * @param mixed  $cache   The cached HTML result, stored in post meta.
193                           * @param string $url     The attempted embed URL.
194                           * @param array  $attr    An array of shortcode attributes.
195                           * @param int    $post_ID Post ID.
196                           */
197                          return apply_filters( 'embed_oembed_html', $cache, $url, $attr, $post_ID );
198                }
199
200                /**
201                 * Filter whether to inspect the given URL for discoverable <link> tags.
202                 *
203                 * @see WP_oEmbed::discover()
204                 *
205                 * @param bool false Whether to enable <link> tag discovery. Default false.
206                 */
 
Line Code
210                $html = wp_oembed_get( $url, $attr );
211
212                // Cache the result
213                $cache = ( $html ) ? $html : '{{unknown}}';
214                update_post_meta( $post_ID, $cachekey, $cache );
215
216                // If there was a result, return it
217                if ( $html ) {
218                     /** This filter is documented in wp-includes/class-wp-embed.php */
219                     return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
220                }
221           }
222
223           // Still unknown
224           return $this->maybe_make_link( $url );
225      }
226
227      /**
228       * Delete all oEmbed caches.