Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get post thumbnail image's url.
<?php
if( has_post_thumbnail() ) {
$thumbnail_id = get_post_thumbnail_id( get_the_ID() );
$image_obj = wp_get_attachment_image_src( $thumbnail_id, 'full' );
echo '<pre>';
print_r( $image_obj[0] );
echo '</pre>' . "\n";
$image_url = esc_url( $image_obj[0] );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.