0

How to get the url of thumbnail and single page link outside the loop. For thumbnail, I tried

    wp_get_attachment_url();

But it is not working for me.

1 Answer 1

0

Just copy and paste below code. you can replace 'get_the_ID()' with page/post id otherwise it will return image for current page/post. cheers!!!

$size = "full";
$urlarr = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),   $size);

$imgurl = $urlarr[0];

this will return complete url of the image.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.