'application/json', 'Authorization' => 'Bearer ' . $api_key, ]; $response = wp_remote_get($url, array( 'headers' => $headers, )); if (is_wp_error($response)) { $error_message = $response->get_error_message(); echo esc_html("Something went wrong: $error_message"); } return $response; } public function render_general_settings() { $save_error = false; $saved_successfully = false; // Saves the Api Key and Placements ID in the wp db if ($_SERVER["REQUEST_METHOD"] == "POST") { $nonce = sanitize_text_field(wp_unslash($_POST['_wpnonce'])); // Verify the nonce if (!isset($nonce) || !wp_verify_nonce($nonce, 'adcaptcha_form_action')) { die('Invalid nonce'); } $api_key = sanitize_text_field(wp_unslash($_POST['adcaptcha_option_name']['api_key'])); $placement_id = sanitize_text_field(wp_unslash($_POST['adcaptcha_option_name']['placement_id'])); $response = $this->verify_input_data($api_key, $placement_id); if ($response['response']['code'] === 200) { update_option('adcaptcha_api_key', $api_key); update_option('adcaptcha_placement_id', $placement_id); update_option('adcaptcha_render_captcha', true); $saved_successfully = true; } else { $save_error = true; update_option('adcaptcha_render_captcha', false); } } ?>

Before integrating, you must have an adCAPTCHA account and gone through the setup process. Dashboard →Documentation →

Settings saved successfully. The captcha will now be displayed.
Placement ID or API Key is Invalid. Please try again. Captcha will not be displayed until the settings are saved successfully.
API Key'; echo ''; ?> Placement ID'; echo ''; ?>