/**
* Get the attachment ID of an image from it's URL.
*
* @link https://pippinsplugins.com/retrieve-attachment-id-from-image-url/
*
* @param $image_url
*
* @return mixed
*/
function dmgist_get_image_id($image_url) {
global $wpdb;
$attachment = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $image_url ));
return $attachment[0];
}