wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_get_attachment_thumb_url › WordPress Function

Seit2.1.0
Veraltetn/v
wp_get_attachment_thumb_url ( $post_id = 0 )
Parameter:
  • (int) $post_id Optional. Attachment ID. Default is the ID of the global `$post`.
    Erforderlich: Nein
    Standard:
Gibt zurück:
  • (string|false) Thumbnail URL on success, false on failure.
Definiert in:
Codex:
Changelog:
  • 6.1.0

Retrieves URL for an attachment thumbnail.



Quellcode

function wp_get_attachment_thumb_url( $post_id = 0 ) {
	$post_id = (int) $post_id;

	/*
	 * This uses image_downsize() which also looks for the (very) old format $image_meta['thumb']
	 * when the newer format $image_meta['sizes']['thumbnail'] doesn't exist.
	 */
	$thumbnail_url = wp_get_attachment_image_url( $post_id, 'thumbnail' );

	if ( empty( $thumbnail_url ) ) {
		return false;
	}

	/**
	 * Filters the attachment thumbnail URL.
	 *
	 * @since 2.1.0
	 *
	 * @param string $thumbnail_url URL for the attachment thumbnail.
	 * @param int    $post_id       Attachment ID.
	 */
	return apply_filters( 'wp_get_attachment_thumb_url', $thumbnail_url, $post_id );
}