function hocwp_is_image($url, $id = 0) { if (hocwp_id_number_valid($id)) { return wp_attachment_is_image($id); } return hocwp_is_image_url($url); }
function hocwp_url_valid($url) { if (!empty($url) && is_string($url)) { if (hocwp_is_image_url($url) || filter_var($url, FILTER_VALIDATE_URL) !== false) { return true; } } return false; }