This function has been deprecated.

wp_get_attachment_thumb_file( int $post_id )

Retrieves thumbnail for an attachment.


Description

Note that this works only for the (very) old image metadata style where ‘thumb’ was set, and the ‘sizes’ array did not exist. This function returns false for the newer image metadata style despite that ‘thumbnail’ is present in the ‘sizes’ array.


Parameters

$post_id

(Optional) Attachment ID. Default is the ID of the global $post.


Return

(string|false) Thumbnail file path on success, false on failure.


Source

File: wp-includes/deprecated.php

function wp_get_attachment_thumb_file( $post_id = 0 ) {
	$post_id = (int) $post_id;
	if ( !$post = get_post( $post_id ) )
		return false;
	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
		return false;

	$file = get_attached_file( $post->ID );

	if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) {
		/**
		 * Filters the attachment thumbnail file path.
		 *
		 * @since WP-2.1.0
		 *
		 * @param string $thumbfile File path to the attachment thumbnail.
		 * @param int    $post_id   Attachment ID.
		 */
		return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
	}
	return false;
}


Changelog

Changelog
Version Description
6.1.0 This function has been deprecated.
2.1.0 Introduced. This function has been deprecated.