function autocron() { $enable = isset($_POST['enable']) ? $_POST['enable'] : false; if ($enable !== false) { SendPress_Option::set('autocron', 'yes'); SendPress_Option::set('allow_tracking', 'yes'); SendPress_Cron::use_iron_cron(); $email = get_option('admin_email'); $url = "http://api.sendpress.com/senddiscountcode/" . md5($_SERVER['SERVER_NAME'] . "|" . $email) . "/" . $email; wp_remote_get($url); } else { SendPress_Option::set('autocron', 'no'); } SendPress::add_cron(); exit; }