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