• hi!

    i’m using this function for printing a page featured image:

    <?php if ( has_post_thumbnail() ) {
    	the_post_thumbnail();
    }
    ?>

    for one page i need not to “print” on screen, but i need to grab the image URL…how can i do?

Viewing 1 replies (of 1 total)
  • Try using wp_get_attachment_url combined with get_post_thumbnail_id :

    $image_src = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );

Viewing 1 replies (of 1 total)
  • The topic ‘retrieve url from "the_post_thumbnail();"’ is closed to new replies.