function gdm_blogger_url_checker() { $clients = new gdm_clients(); foreach ($clients->list as $clientid => $client) { if (!empty($client['url'])) { $remote = wp_remote_get($client['url'] . '/wp-json/'); if (is_wp_error($remote)) { $error_message = $remote->get_error_message(); $clients->set_error($clientid, "http_response", $error_message); } elseif ($remote['response']['code'] >= 300) { $clients->set_error($clientid, "http_response", $remote['response']['message']); } else { $response_body = json_decode($remote['body'], true); if (!in_array("e_ct/v1", $response_body['namespaces']) || !in_array("wp/v2", $response_body['namespaces'])) { $clients->set_error($clientid, "remote_namespace", $response_body['namespaces']); } } } else { $clients->set_error($clientid, "url_missing", "As of " . time() . " the clients URL was missing from their profile"); } } return; }