the_post_thumbnail_url

Display the post thumbnail URL.

Description

the_post_thumbnail_url( (string) $size = 'post-thumbnail' ); 

Parameters (1)

0. $size — Optional. (string) => 'post-thumbnail'
Image size to use. Accepts any valid image size, or an array of width and height values in pixels (in that order). Default post-thumbnail..

Usage

  1. if ( !function_exists( 'the_post_thumbnail_url' ) ) { 
  2. require_once ABSPATH . WPINC . '/post-thumbnail-template.php'; 
  3. $size = 'post-thumbnail'; 
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = the_post_thumbnail_url($size); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post-thumbnail-template.php  
  1. function the_post_thumbnail_url( $size = 'post-thumbnail' ) { 
  2. $url = get_the_post_thumbnail_url( null, $size ); 
  3. if ( $url ) { 
  4. echo esc_url( $url );