public static function isFrontendAjax()
    {
        if (self::isAjax()) {
            $referer = '';
            $filename = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '';

            if (!empty($_REQUEST['_wp_http_referer'])) {
                $referer = wp_unslash($_REQUEST['_wp_http_referer']);
            } elseif (!empty($_SERVER['HTTP_REFERER'])) {
                $referer = wp_unslash($_SERVER['HTTP_REFERER']);
            }

            return strpos($referer, admin_url()) === false && basename($filename) === 'admin-ajax.php';
        }

        return false;
    }