WordPress-Plugin-Template icon indicating copy to clipboard operation
WordPress-Plugin-Template copied to clipboard

get_option('wpt_an_image') returns a number not a url string

Open Drivez opened this issue 7 years ago • 1 comments

when i use get_option('wpt_an_image') it returns a number not a url string i can use to referace the image

in my case: $image = get_option('mkit_an_image','No Image Selected!'); $html = '<img src="' . $image .'">'; Returns <img src="4">

Drivez avatar Mar 13 '17 10:03 Drivez

It's the attachment ID. Use wp_get_attachment_url to get the url.

https://developer.wordpress.org/reference/functions/wp_get_attachment_image/ https://codex.wordpress.org/Function_Reference/wp_get_attachment_url

luizbills avatar Apr 26 '17 14:04 luizbills