//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']), ''); }