diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php
index 019086c3b8..ecac41b7a2 100644
--- a/src/wp-includes/media.php
+++ b/src/wp-includes/media.php
@@ -945,6 +945,46 @@ function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon
 	return isset( $image['0'] ) ? $image['0'] : false;
 }
 
+/**
+ * Get the size path of an image attachment.
+ *
+ * @param int          $attachment_id Attachment ID.
+ * @param string|array $size Optional. Image size to retrieve. Accepts any valid image size, or an array
+ *                           of width and height values. Default 'thumbnail'
+ *
+ * @return string|null Attachment path or null if no image is available.
+ */
+function wp_get_attachment_image_file( $attachment_id, $size = 'thumbnail' ) {
+
+	if ( 0 === (int) $attachment_id ) {
+		return null;
+	}
+
+	$attachment_metadata = wp_get_attachment_metadata( $attachment_id );
+
+	if ( ! $attachment_metadata ) {
+		return null;
+	}
+
+	$file_name = isset( $attachment_metadata['sizes'][ $size ]['file'] ) ? $attachment_metadata['sizes'][ $size ]['file'] : false;
+
+	$file = dirname( $attachment_metadata['file'] ) . '/' . $file_name;
+
+	$file_path = _wp_get_attachment_relative_path( $file );
+
+	if ( empty( $file_path ) ) {
+		return null;
+	}
+
+	$wp_upload_dir = wp_upload_dir( null, null );
+
+	$path = $wp_upload_dir['basedir'] . '/' . trailingslashit( $file_path ) . $file_name;
+
+	return $path;
+
+}
+
+
 /**
  * Get the attachment path relative to the upload directory.
  *
diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
index eb69ac727b..5250aaa294 100644
--- a/src/wp-includes/post.php
+++ b/src/wp-includes/post.php
@@ -5689,6 +5689,7 @@ function wp_get_attachment_caption( $post_id = 0 ) {
  * Retrieve thumbnail for an attachment.
  *
  * @since 2.1.0
+ * @deprecated 5.2 Use wp_get_attachment_image_file( $attachment_id, $size = 'thumbnail' )
  *
  * @param int $post_id Optional. Attachment ID. Default 0.
  * @return string|false False on failure. Thumbnail file path on success.
diff --git a/tests/phpunit/tests/media/getImageAttachmentSize.php b/tests/phpunit/tests/media/getImageAttachmentSize.php
new file mode 100644
index 0000000000..37f2162f53
--- /dev/null
+++ b/tests/phpunit/tests/media/getImageAttachmentSize.php
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * @group media
+ */
+class Tests_Media_GetImageAttachmentSize extends WP_UnitTestCase {
+
+	/** @var array WP Upload Dir. */
+	protected $wp_upload_dir;
+
+	public function setUp() {
+		$this->wp_upload_dir = wp_upload_dir();
+
+		parent::setUp();
+	}
+
+	/**
+	 * Creating file.
+	 *
+	 * @param string $file_name Image file name.
+	 *
+	 * @return int Attachment ID.
+	 */
+	protected function upload_image( $file_name ) {
+		$post_id = self::factory()->post->create( [ 'post_author' => 1 ] );
+
+		\copy( DIR_TESTDATA . '/images/' . $file_name, $this->wp_upload_dir['path'] . '/' . $file_name );
+
+		$file = $this->wp_upload_dir['path'] . '/' . $file_name;
+
+		$wp_filetype = wp_check_filetype( basename( $file ), null );
+
+		$attachment_id = wp_insert_attachment(
+			[
+				'post_mime_type' => $wp_filetype['type'],
+				'post_status'    => 'inherit',
+				'post_title'     => preg_replace( '/\.[^.]+$/', '', basename( $file ) ),
+				'post_content'   => '',
+			],
+			$file,
+			$post_id
+		);
+
+		$attachment_data = wp_generate_attachment_metadata( $attachment_id, $file );
+
+		wp_update_attachment_metadata( $attachment_id, $attachment_data, $post_id );
+
+		return $attachment_id;
+	}
+
+	public function test_get_attachment_image_size() {
+		$attachment_id = $this->upload_image( 'waffles.jpg' );
+
+		$file_size = wp_get_attachment_image_file( $attachment_id, 'medium' );
+
+		$this->assertContains( 'waffles-300x200.jpg', $file_size );
+	}
+
+	public function test_get_custom_attachment_image_size() {
+		add_image_size( 'custom', 400, 400, true );
+
+		$attachment_id = $this->upload_image( 'canola.jpg' );
+
+		$file_size = wp_get_attachment_image_file( $attachment_id, 'custom' );
+
+		$this->assertContains( 'canola-400x400.jpg', $file_size );
+	}
+}
