options["connector_id"].'?projectid='.$ai12z->options["project_id"]; if (!$webhook_url) return; // No URL configured // Send the full extracted text content (post body + custom-field text), minus // any fields excluded for this content type — identical to the initial sync. $post = get_post($post_id); if (!$post) return; // Post no longer available $exclusions = ai12z_get_type_exclusions($post->post_type); $content = get_full_post_text_content($post_id, 'html', $exclusions) ?: ""; $post_data = [ 'post_id' => $post_id, 'post_status' => get_post_status($post_id), 'post_title' => $post->post_title, "post_type" => $post_type, "post_content" => $content, "post_description" => $post->post_excerpt, "post_metadata" => get_post_meta($post_id), ]; $response = wp_remote_post($webhook_url, [ 'body' => wp_json_encode($post_data), 'headers' => [ 'Content-Type' => 'application/json', ], ]); if (is_wp_error($response)) { $error_message = $response->get_error_message(); ai12z_log("Webhook send failed: $error_message"); } }