Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 47420)
+++ wp-includes/media.php	(working copy)
@@ -176,7 +176,7 @@
  *
  * @since 2.5.0
  *
- * @param int          $id   Attachment ID for image.
+ * @param int          $attachment   Attachment post or attachment ID for image. Defaults to global $post.
  * @param string|int[] $size Optional. Image size to scale to. Accepts any valid image size name,
  *                           or an array of width and height values in pixels (in that order).
  *                           Default 'medium'.
@@ -189,8 +189,15 @@
  *     @type bool   $3 Whether the image is a resized image.
  * }
  */
-function image_downsize( $id, $size = 'medium' ) {
-	$is_image = wp_attachment_is_image( $id );
+function image_downsize( $attachment = null, $size = 'medium' ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
+		return false;
+	}
+	
+	$is_image = wp_attachment_is_image( $post );
 
 	/**
 	 * Filters whether to preempt the output of image_downsize().
@@ -204,15 +211,16 @@
 	 * @param int          $id       Attachment ID for image.
 	 * @param array|string $size     Requested size of image. Image size name, or array of width
 	 *                               and height values (in that order).
+	 * @param WP_Post      $attachment Attachment post object.
 	 */
-	$out = apply_filters( 'image_downsize', false, $id, $size );
+	$out = apply_filters( 'image_downsize', false, $post->ID, $size, $post );
 
 	if ( $out ) {
 		return $out;
 	}
 
-	$img_url          = wp_get_attachment_url( $id );
-	$meta             = wp_get_attachment_metadata( $id );
+	$img_url          = wp_get_attachment_url( $post );
+	$meta             = wp_get_attachment_metadata( $post );
 	$width            = 0;
 	$height           = 0;
 	$is_intermediate  = false;
@@ -232,7 +240,7 @@
 	}
 
 	// Try for a new style intermediate size.
-	$intermediate = image_get_intermediate_size( $id, $size );
+	$intermediate = image_get_intermediate_size( $post, $size );
 
 	if ( $intermediate ) {
 		$img_url         = str_replace( $img_url_basename, $intermediate['file'], $img_url );
@@ -241,7 +249,7 @@
 		$is_intermediate = true;
 	} elseif ( 'thumbnail' === $size ) {
 		// Fall back to the old thumbnail.
-		$thumb_file = wp_get_attachment_thumb_file( $id );
+		$thumb_file = wp_get_attachment_thumb_file( $post );
 		$info       = null;
 
 		if ( $thumb_file ) {
@@ -363,7 +371,7 @@
  *
  * @since 2.5.0
  *
- * @param int          $id    Attachment ID.
+ * @param int          $attachment Attachment post or post ID.
  * @param string       $alt   Image description for the alt attribute.
  * @param string       $title Image description for the title attribute.
  * @param string       $align Part of the class name for aligning the image.
@@ -372,8 +380,16 @@
  *                            (in that order). Default 'medium'.
  * @return string HTML IMG element for given image attachment
  */
-function get_image_tag( $id, $alt, $title, $align, $size = 'medium' ) {
-
+function get_image_tag( $attachment, $alt, $title, $align, $size = 'medium' ) {
+	
+	if( $attachment instanceof WP_Post && 'attachment' == $attachment->post_type ) {
+		$id = $attachment->ID;
+	} else if( is_numeric( $attachment ) ) {
+		$id = $attachment;
+	} else {
+		return '';
+	}
+	
 	list( $img_src, $width, $height ) = image_downsize( $id, $size );
 	$hwstring                         = image_hwstring( $width, $height );
 
@@ -391,8 +407,9 @@
 	 * @param string       $align Part of the class name for aligning the image.
 	 * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
 	 *                            Default 'medium'.
+	 * @param WP_Post      $attachment Attachment post object.
 	 */
-	$class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
+	$class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size);
 
 	$html = '<img src="' . esc_attr( $img_src ) . '" alt="' . esc_attr( $alt ) . '" ' . $title . $hwstring . 'class="' . $class . '" />';
 
@@ -408,6 +425,7 @@
 	 * @param string       $align Part of the class name for aligning the image.
 	 * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
 	 *                            Default 'medium'.
+	 * @param WP_Post      $attachment Attachment post object.
 	 */
 	return apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
 }
@@ -743,7 +761,7 @@
  *
  * @since 2.5.0
  *
- * @param int          $post_id Attachment ID.
+ * @param int          $attachment Attachment post or post ID.
  * @param array|string $size    Optional. Image size. Accepts any valid image size, or an array
  *                              of width and height values in pixels (in that order).
  *                              Default 'thumbnail'.
@@ -758,10 +776,12 @@
  *     @type string $url    Image's URL.
  * }
  */
-function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) {
-	$imagedata = wp_get_attachment_metadata( $post_id );
+function image_get_intermediate_size( $attachment, $size = 'thumbnail' ) {
+	
+	$post = get_post( $attachment );
+	$imagedata = wp_get_attachment_metadata( $post );
 
-	if ( ! $size || ! is_array( $imagedata ) || empty( $imagedata['sizes'] ) ) {
+	if ( ! $size || ! $post || ! is_array( $imagedata ) || empty( $imagedata['sizes'] ) ) {
 		return false;
 	}
 
@@ -830,7 +850,7 @@
 
 	// Include the full filesystem path of the intermediate file.
 	if ( empty( $data['path'] ) && ! empty( $data['file'] ) && ! empty( $imagedata['file'] ) ) {
-		$file_url     = wp_get_attachment_url( $post_id );
+		$file_url     = wp_get_attachment_url( $post );
 		$data['path'] = path_join( dirname( $imagedata['file'] ), $data['file'] );
 		$data['url']  = path_join( dirname( $file_url ), $data['file'] );
 	}
@@ -847,8 +867,9 @@
 	 * @param int          $post_id The post_id of the image attachment
 	 * @param string|array $size    Registered image size or flat array of initially-requested height and width
 	 *                              dimensions (in that order).
+	 * @param WP_Post      $attachment Attachment post object.
 	 */
-	return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
+	return apply_filters( 'image_get_intermediate_size', $data, $post->ID, $size, $post );
 }
 
 /**
@@ -937,7 +958,7 @@
  *
  * @since 2.5.0
  *
- * @param int          $attachment_id Image attachment ID.
+ * @param int          $attachment    Attachment post or post ID. Defaults to global $post.
  * @param string|int[] $size          Optional. Image size. Accepts any valid image size name, or an array of width
  *                                    and height values in pixels (in that order). Default 'thumbnail'.
  * @param bool         $icon          Optional. Whether the image should fall back to a mime type icon. Default false.
@@ -949,8 +970,16 @@
  *     @type int    $2 Image height in pixels.
  * }
  */
-function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
+function wp_get_attachment_image_src( $attachment = null, $size = 'thumbnail', $icon = false ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
+		return false;
+	}
+	
 	// Get a thumbnail or intermediate image if there is one.
+	$attachment_id = $post->ID;
 	$image = image_downsize( $attachment_id, $size );
 	if ( ! $image ) {
 		$src = false;
@@ -987,8 +1016,9 @@
 	 * @param string|int[] $size          Requested size of image. Image size name, or array of width
 	 *                                    and height values (in that order).
 	 * @param bool         $icon          Whether the image should be treated as an icon.
+	 * @param WP_Post      $attachment    Attachment post object.
 	 */
-	return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon );
+	return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon, $post );
 }
 
 /**
@@ -1001,7 +1031,7 @@
  *
  * @since 2.5.0
  *
- * @param int          $attachment_id Image attachment ID.
+ * @param int          $attachment    Attachment post or post ID. Defaults to global $post.
  * @param string|array $size          Optional. Image size. Accepts any valid image size, or an array of width
  *                                    and height values in pixels (in that order). Default 'thumbnail'.
  * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
@@ -1018,9 +1048,16 @@
  * }
  * @return string HTML img element or empty string on failure.
  */
-function wp_get_attachment_image( $attachment_id, $size = 'thumbnail', $icon = false, $attr = '' ) {
+function wp_get_attachment_image( $attachment = null, $size = 'thumbnail', $icon = false, $attr = '' ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
+		return '';
+	}
+	
 	$html  = '';
-	$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
+	$image = wp_get_attachment_image_src( $post, $size, $icon );
 	if ( $image ) {
 		list( $src, $width, $height ) = $image;
 		$hwstring                     = image_hwstring( $width, $height );
@@ -1028,11 +1065,10 @@
 		if ( is_array( $size_class ) ) {
 			$size_class = join( 'x', $size_class );
 		}
-		$attachment   = get_post( $attachment_id );
 		$default_attr = array(
 			'src'   => $src,
 			'class' => "attachment-$size_class size-$size_class",
-			'alt'   => trim( strip_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ),
+			'alt'   => trim( strip_tags( get_post_meta( $post->ID, '_wp_attachment_image_alt', true ) ) ),
 		);
 
 		$attr = wp_parse_args( $attr, $default_attr );
@@ -1039,12 +1075,12 @@
 
 		// Generate 'srcset' and 'sizes' if not already present.
 		if ( empty( $attr['srcset'] ) ) {
-			$image_meta = wp_get_attachment_metadata( $attachment_id );
+			$image_meta = wp_get_attachment_metadata( $post );
 
 			if ( is_array( $image_meta ) ) {
 				$size_array = array( absint( $width ), absint( $height ) );
-				$srcset     = wp_calculate_image_srcset( $size_array, $src, $image_meta, $attachment_id );
-				$sizes      = wp_calculate_image_sizes( $size_array, $src, $image_meta, $attachment_id );
+				$srcset     = wp_calculate_image_srcset( $size_array, $src, $image_meta, $post->ID );
+				$sizes      = wp_calculate_image_sizes( $size_array, $src, $image_meta, $post->ID );
 
 				if ( $srcset && ( $sizes || ! empty( $attr['sizes'] ) ) ) {
 					$attr['srcset'] = $srcset;
@@ -1067,7 +1103,7 @@
 		 * @param string|array $size       Requested size. Image size or array of width and height values
 		 *                                 (in that order). Default 'thumbnail'.
 		 */
-		$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
+		$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $post, $size );
 		$attr = array_map( 'esc_attr', $attr );
 		$html = rtrim( "<img $hwstring" );
 		foreach ( $attr as $name => $value ) {
@@ -1084,14 +1120,14 @@
  *
  * @since 4.4.0
  *
- * @param int          $attachment_id Image attachment ID.
+ * @param int          $attachment    Attachment post or post ID. Defaults to global $post.
  * @param string|array $size          Optional. Image size to retrieve. Accepts any valid image size, or an array
  *                                    of width and height values in pixels (in that order). Default 'thumbnail'.
  * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
  * @return string|false Attachment URL or false if no image is available.
  */
-function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
-	$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
+function wp_get_attachment_image_url( $attachment = null, $size = 'thumbnail', $icon = false ) {
+	$image = wp_get_attachment_image_src( $attachment, $size, $icon );
 	return isset( $image['0'] ) ? $image['0'] : false;
 }
 
@@ -1155,7 +1191,7 @@
  *
  * @see wp_calculate_image_srcset()
  *
- * @param int          $attachment_id Image attachment ID.
+ * @param int          $attachment    Attachment post or post ID. Defaults to global $post.
  * @param array|string $size          Optional. Image size. Accepts any valid image size, or an array of
  *                                    width and height values in pixels (in that order). Default 'medium'.
  * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
@@ -1162,8 +1198,15 @@
  *                                    Default null.
  * @return string|bool A 'srcset' value string or false.
  */
-function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null ) {
-	$image = wp_get_attachment_image_src( $attachment_id, $size );
+function wp_get_attachment_image_srcset( $attachment = null, $size = 'medium', $image_meta = null ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
+		return false;
+	}
+	
+	$image = wp_get_attachment_image_src( $post, $size );
 
 	if ( ! $image ) {
 		return false;
@@ -1170,7 +1213,7 @@
 	}
 
 	if ( ! is_array( $image_meta ) ) {
-		$image_meta = wp_get_attachment_metadata( $attachment_id );
+		$image_meta = wp_get_attachment_metadata( $post );
 	}
 
 	$image_src  = $image[0];
@@ -1179,7 +1222,7 @@
 		absint( $image[2] ),
 	);
 
-	return wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id );
+	return wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $post->ID );
 }
 
 /**
@@ -1396,7 +1439,7 @@
  *
  * @see wp_calculate_image_sizes()
  *
- * @param int          $attachment_id Image attachment ID.
+ * @param int          $attachment    Attachment post or post ID. Defaults to global $post.
  * @param array|string $size          Optional. Image size. Accepts any valid image size, or an array of width
  *                                    and height values in pixels (in that order). Default 'medium'.
  * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
@@ -1403,8 +1446,15 @@
  *                                    Default null.
  * @return string|bool A valid source size value for use in a 'sizes' attribute or false.
  */
-function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image_meta = null ) {
-	$image = wp_get_attachment_image_src( $attachment_id, $size );
+function wp_get_attachment_image_sizes( $attachment = null, $size = 'medium', $image_meta = null ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
+		return false;
+	}
+	
+	$image = wp_get_attachment_image_src( $post, $size );
 
 	if ( ! $image ) {
 		return false;
@@ -1411,7 +1461,7 @@
 	}
 
 	if ( ! is_array( $image_meta ) ) {
-		$image_meta = wp_get_attachment_metadata( $attachment_id );
+		$image_meta = wp_get_attachment_metadata( $post );
 	}
 
 	$image_src  = $image[0];
@@ -1420,7 +1470,7 @@
 		absint( $image[2] ),
 	);
 
-	return wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id );
+	return wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $post->ID );
 }
 
 /**
@@ -4473,4 +4523,4 @@
 	add_image_size( '1536x1536', 1536, 1536 );
 	// 2x large size.
 	add_image_size( '2048x2048', 2048, 2048 );
-}
+}
\ No newline at end of file
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 47420)
+++ wp-includes/post.php	(working copy)
@@ -5770,14 +5770,15 @@
  *
  * @since 2.1.0
  *
- * @param int  $attachment_id Attachment post ID. Defaults to global $post.
+ * @param int|WP_Post  $attachment Attachment post or post ID. Defaults to global $post.
  * @param bool $unfiltered    Optional. If true, filters are not run. Default false.
  * @return mixed Attachment meta field. False on failure.
  */
-function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) {
-	$attachment_id = (int) $attachment_id;
-	$post          = get_post( $attachment_id );
-	if ( ! $post ) {
+function wp_get_attachment_metadata( $attachment = null, $unfiltered = false ) {
+
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
 		return false;
 	}
 
@@ -5795,8 +5796,9 @@
 	 * @param array|bool $data          Array of meta data for the given attachment, or false
 	 *                                  if the object does not exist.
 	 * @param int        $attachment_id Attachment post ID.
+	 * @param WP_Post    $attachment Attachment WP_Post object.
 	 */
-	return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
+	return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID, $post );
 }
 
 /**
@@ -5804,14 +5806,15 @@
  *
  * @since 2.1.0
  *
- * @param int   $attachment_id Attachment post ID.
+ * @param int|WP_Post   $attachment Attachment post or post ID.
  * @param array $data          Attachment meta data.
  * @return int|bool False if $post is invalid.
  */
-function wp_update_attachment_metadata( $attachment_id, $data ) {
-	$attachment_id = (int) $attachment_id;
-	$post          = get_post( $attachment_id );
-	if ( ! $post ) {
+function wp_update_attachment_metadata( $attachment, $data ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
 		return false;
 	}
 
@@ -5822,8 +5825,9 @@
 	 *
 	 * @param array $data          Array of updated attachment meta data.
 	 * @param int   $attachment_id Attachment post ID.
+	 * @param WP_Post $attachment Attachment WP_Post object.
 	 */
-	$data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID );
+	$data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID, $post );
 	if ( $data ) {
 		return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
 	} else {
@@ -5838,20 +5842,17 @@
  *
  * @global string $pagenow
  *
- * @param int $attachment_id Optional. Attachment post ID. Defaults to global $post.
+ * @param int|WP_Post $attachment Optional. Attachment post or post ID. Defaults to the global $post.
  * @return string|false Attachment URL, otherwise false.
  */
-function wp_get_attachment_url( $attachment_id = 0 ) {
-	$attachment_id = (int) $attachment_id;
-	$post          = get_post( $attachment_id );
-	if ( ! $post ) {
+function wp_get_attachment_url( $attachment = null ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
 		return false;
 	}
 
-	if ( 'attachment' != $post->post_type ) {
-		return false;
-	}
-
 	$url = '';
 	// Get attached file.
 	$file = get_post_meta( $post->ID, '_wp_attached_file', true );
@@ -5893,8 +5894,9 @@
 	 *
 	 * @param string $url           URL for the given attachment.
 	 * @param int    $attachment_id Attachment post ID.
+	 * @param WP_Post $attachment Attachment WP_Post object.
 	 */
-	$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
+	$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID, $post );
 
 	if ( empty( $url ) ) {
 		return false;
@@ -5908,20 +5910,17 @@
  *
  * @since 4.6.0
  *
- * @param int $post_id Optional. Attachment ID. Default is the ID of the global `$post`.
+ * @param int|WP_Post $attachment Optional. Attachment post or post ID. Defaults to the global $post.
  * @return string|false False on failure. Attachment caption on success.
  */
-function wp_get_attachment_caption( $post_id = 0 ) {
-	$post_id = (int) $post_id;
-	$post    = get_post( $post_id );
-	if ( ! $post ) {
+function wp_get_attachment_caption( $attachment = null ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' !== $post->post_type ) {
 		return false;
 	}
 
-	if ( 'attachment' !== $post->post_type ) {
-		return false;
-	}
-
 	$caption = $post->post_excerpt;
 
 	/**
@@ -5930,9 +5929,10 @@
 	 * @since 4.6.0
 	 *
 	 * @param string $caption Caption for the given attachment.
-	 * @param int    $post_id Attachment ID.
+	 * @param int    $attachment_id Attachment ID.
+	 * @param WP_Post $attachment Attachment WP_Post object.
 	 */
-	return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID );
+	return apply_filters( 'wp_get_attachment_caption', $caption, $post->ID, $post );
 }
 
 /**
@@ -5940,13 +5940,14 @@
  *
  * @since 2.1.0
  *
- * @param int $post_id Optional. Attachment ID. Default 0.
+ * @param int|WP_Post $attachment Optional. Attachment post or post ID. Defaults to the global post.
  * @return string|false False on failure. Thumbnail file path on success.
  */
-function wp_get_attachment_thumb_file( $post_id = 0 ) {
-	$post_id = (int) $post_id;
-	$post    = get_post( $post_id );
-	if ( ! $post ) {
+function wp_get_attachment_thumb_file( $attachment = null ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
 		return false;
 	}
 
@@ -5954,9 +5955,9 @@
 	if ( ! is_array( $imagedata ) ) {
 		return false;
 	}
-
+	
 	$file = get_attached_file( $post->ID );
-
+	
 	if ( ! empty( $imagedata['thumb'] ) ) {
 		$thumbfile = str_replace( wp_basename( $file ), $imagedata['thumb'], $file );
 		if ( file_exists( $thumbfile ) ) {
@@ -5965,10 +5966,11 @@
 			 *
 			 * @since 2.1.0
 			 *
-			 * @param string $thumbfile File path to the attachment thumbnail.
-			 * @param int    $post_id   Attachment ID.
+			 * @param string $thumbfile       File path to the attachment thumbnail.
+			 * @param int    $attachment_id   Attachment ID.
+			 * @param WP_Post $attachment     Attachment post object.
 			 */
-			return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
+			return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID, $post );
 		}
 	}
 	return false;
@@ -5979,13 +5981,14 @@
  *
  * @since 2.1.0
  *
- * @param int $post_id Optional. Attachment ID. Default 0.
+ * @param int|WP_Post $attachment Optional. Attachment post or post ID. Defaults to the global post.
  * @return string|false False on failure. Thumbnail URL on success.
  */
-function wp_get_attachment_thumb_url( $post_id = 0 ) {
-	$post_id = (int) $post_id;
-	$post    = get_post( $post_id );
-	if ( ! $post ) {
+function wp_get_attachment_thumb_url( $attachment = null ) {
+	
+	$post = get_post( $attachment );
+	
+	if ( ! $post || 'attachment' != $post->post_type ) {
 		return false;
 	}
 
@@ -5994,7 +5997,7 @@
 		return false;
 	}
 
-	$sized = image_downsize( $post_id, 'thumbnail' );
+	$sized = image_downsize( $post->ID, 'thumbnail' );
 	if ( $sized ) {
 		return $sized[0];
 	}
@@ -6012,9 +6015,10 @@
 	 * @since 2.1.0
 	 *
 	 * @param string $url     URL for the attachment thumbnail.
-	 * @param int    $post_id Attachment ID.
+	 * @param int    $attachment_id Attachment ID.
+	 * @param WP_Post $attachment Attachment post object.
 	 */
-	return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
+	return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID, $post );
 }
 
 /**
@@ -6027,8 +6031,10 @@
  * @return bool True if one of the accepted types, false otherwise.
  */
 function wp_attachment_is( $type, $post = null ) {
+	
 	$post = get_post( $post );
-	if ( ! $post ) {
+	
+	if ( ! $post  || 'attachment' != $post->post_type ) {
 		return false;
 	}
 
@@ -7263,4 +7269,4 @@
 	 * @param int    $attachment_id      Attachment ID.
 	 */
 	return apply_filters( 'wp_get_original_image_url', $original_image_url, $attachment_id );
-}
+}
\ No newline at end of file
