Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wordpress get post featured image

//default 
$image_url = wp_get_attachment_url(1234);
// change if post have feature image
if (has_post_thumbnail($recent_post['ID'])) {
	$image_url = wp_get_attachment_url(get_post_thumbnail_id($recent_post['ID']), '');
}
Source by developer.wordpress.org #
 
PREVIOUS NEXT
Tagged: #wordpress #post #featured #image
ADD COMMENT
Topic
Name
9+9 =