Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: oembed_request_post_id

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
1062  * @param string      $url    The URL that should be inspected for discovery `<link>` tags.
1063  * @param array       $args   oEmbed remote get arguments.
1064  * @return null|string The UNSANITIZED (and potentially unsafe) HTML that should be used to embed.
1065  *                     Null if the URL does not belong to the current site.
1066  */
1067 function wp_filter_pre_oembed_result( $result, $url, $args ) {
1068      $post_id = url_to_postid( $url );
1069
1070      /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
1071      $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url );
1072
1073      if ( ! $post_id ) {
1074           return $result;
1075      }
1076
1077      $width = isset( $args['width'] ) ? $args['width'] : 0;
1078
1079      $data = get_oembed_response_data( $post_id, $width );
1080      $data = _wp_oembed_get_object()->data2html( (object) $data, $url );