# WordPress Integration Fixes

## Issues Fixed

### 1. Validation Error (400 Bad Request)
**Problem**: When creating WordPress integration with API key-only authentication, the backend was rejecting the request because `username` and `app_password` were empty strings.

**Root Cause**: The serializer was validating credentials but didn't account for API key-only authentication where username/password are optional.

**Fix**: Added custom validation in `SiteIntegrationSerializer` to allow API key-only authentication for WordPress platform:
- If `api_key` is provided in `credentials_json`, username and app_password are optional
- If `api_key` is not provided, username and app_password are required (traditional auth)

**File**: `backend/igny8_core/modules/integration/views.py`

### 2. Status Indicator Not Showing Connected
**Problem**: Status indicator showed "Not configured" even when integration existed and was active.

**Root Cause**: Status check only looked for `site?.wp_api_key` but didn't check for API key in integration's `credentials_json`.

**Fix**: Updated status check to look for API key in both:
- Site's `wp_api_key` field
- Integration's `credentials_json.api_key` field

**File**: `frontend/src/pages/Sites/Settings.tsx`

### 3. Integration Creation Error Handling
**Problem**: When toggling integration enabled without API key, no clear error was shown.

**Fix**: Added error handling to show clear message when trying to enable integration without API key.

**File**: `frontend/src/components/sites/WordPressIntegrationForm.tsx`

## Content Sync Status

Content sync will work as long as:
1. ✅ Integration exists in database
2. ✅ Integration `is_active = True`
3. ✅ Integration `sync_enabled = True`

The sync service checks these conditions before performing sync operations.

## Testing Checklist

- [x] Create WordPress integration with API key only (no username/password)
- [x] Status indicator shows "Configured" when integration exists and is active
- [x] Status indicator shows "Connected" after successful connection test
- [x] Content sync works when integration is active and sync_enabled
- [x] Error messages are clear when API key is missing

