

# WordPress Integration Audit Report

## Overview

The WordPress plugin (IGNY8 WP Bridge v1.3.3) has been built with extensive features, many of which are either not fully implemented on the IGNY8 app side or are too complex for current needs.

---

## 1. CONTROLS PAGE (Plugin)

### What It Does:
The "Controls" page in the WordPress plugin lets users configure which content types and features should sync between WordPress and IGNY8.

### Current Components:

#### A) **Post Types to Sync**
- Shows: Posts, Pages, Products (if WooCommerce installed)
- **Purpose**: Determines which WordPress post types IGNY8 can publish to
- **What Actually Works**: Only "Posts" is fully functional. Pages and Products publishing is NOT implemented in IGNY8 app yet.

#### B) **Taxonomies to Sync**
- Shows: Categories, Tags, Product Categories, Product Tags, Product Shipping Classes, IGNY8 Sectors, IGNY8 Clusters, Brand, Brands, Expired
- **Purpose**: Determines which taxonomy terms sync between systems
- **What Actually Works**: Only Categories, Tags, IGNY8 Sectors, IGNY8 Clusters are used. The rest are either WooCommerce-specific (not supported) or custom taxonomies from the specific WordPress site.

#### C) **Control Mode** (Mirror vs Hybrid)
- **Mirror Mode**: IGNY8 is source of truth. WordPress reflects changes only. Content is read-only in WordPress.
- **Hybrid Mode**: Two-way sync. WordPress editors can edit content and changes sync back to IGNY8.
- **What Actually Works**: **NOTHING**. This is purely UI. The backend code doesn't check or enforce either mode. Content can always be edited in WordPress and it does NOT sync back to IGNY8. This is misleading UI.

#### D) **IGNY8 Modules**
- Shows: Sites (Data & Semantic Map), Planner (Keywords & Briefs), Writer (Tasks & Posts), Linker (Internal Links), Optimizer (Audits & Scores)
- **Purpose**: Allow users to disable specific IGNY8 features if they're not using them
- **What Actually Works**: **NOTHING**. This is purely UI. The plugin doesn't actually enable/disable any module functionality. These checkboxes have no effect on what gets synced or displayed.

#### E) **Default Post Status**
- Draft or Publish
- **Purpose**: When IGNY8 publishes content, should it be saved as Draft (for review) or Published immediately
- **What Actually Works**: **YES, this works**. The plugin checks this setting when receiving content from IGNY8.

#### F) **Sync WooCommerce Products**
- Checkbox (only shown if WooCommerce installed)
- **What Actually Works**: **NOT IMPLEMENTED** in IGNY8 app. WooCommerce product sync is planned but not built.

---

## 2. SYNC PAGE (Plugin)

### What It Does:
Shows sync status and history for different data types.

### Current Components:

#### A) **Sync Status Toggle**
- "Enable IGNY8 Sync" checkbox
- **Purpose**: Master switch to enable/disable all syncing
- **What Actually Works**: **YES, this works**. When disabled, the plugin rejects incoming content from IGNY8.

#### B) **Sync History**
- Shows: Site Data, Taxonomies, Keywords, Writers
- Shows last sync timestamp and status (Synced/Never)
- **What Actually Works**: **MISLEADING**. 
  - "Site Data" = metadata about WordPress site sent TO IGNY8 (one-way)
  - "Taxonomies" = categories/tags metadata
  - "Keywords" = NOT IMPLEMENTED (seed keywords feature)
  - "Writers" = NOT IMPLEMENTED (author sync feature)

#### C) **Scheduled Syncs**
- Shows next scheduled site data sync
- **What Actually Works**: WordPress cron job that periodically sends site metadata to IGNY8. Works but rarely used.

---

## 3. DATA PAGE (Plugin)

### What It Does:
Shows internal link queue status.

### Current Components:
- Total Links, Pending, Processed counts
- Link Queue table showing posts, target URLs, anchors, status

### What Actually Works:
This is for the **LINKER** module - internal linking automation. When IGNY8 sends a post with internal link suggestions, they go into this queue and get processed.

**Current Status**: Linker module is partially implemented but not production-ready in IGNY8 app.

---

## 4. CONTENT TYPES PAGE (IGNY8 App - Site Settings)

### What It Does:
Shows WordPress site structure fetched from the plugin:
- Post Types (Pages, Posts, Products) with counts and "Enabled/Disabled" badges
- Taxonomies (Categories, Tags, etc.) with counts and "Enabled/Disabled" badges
- "Sync Structure" button to refresh data

### What Actually Works:
- **Sync Structure** = Calls WordPress plugin's `/igny8/v1/site-metadata/` endpoint to get counts
- **Enabled/Disabled** = Reflects what's checked in WordPress plugin's Controls page
- **Limit: 100** = Fetch limit per type (hardcoded, not configurable in app)

### Purpose:
This page is **informational only** - shows what's available on WordPress side. User cannot change anything here. They must change settings in WordPress plugin.

### Problem:
The "Enabled/Disabled" comes from WordPress but the IGNY8 app has NO way to enable/disable content types. It's display-only and confusing.

---

## 5. What Actually Gets Synced

### IGNY8 → WordPress (Working):
1. **Published Content**: When content is approved in IGNY8 and published, it gets sent to WordPress
2. **Categories**: IGNY8 categories sync as WordPress categories
3. **Tags**: IGNY8 tags sync as WordPress tags
4. **IGNY8 Sectors**: Custom taxonomy for content organization
5. **IGNY8 Clusters**: Custom taxonomy for content clustering
6. **Featured Images**: Images are uploaded to WordPress media library

### WordPress → IGNY8 (Working):
1. **Site Metadata**: Post counts, taxonomy counts (for display in app)
2. **Post Status Updates**: Webhooks notify IGNY8 when WordPress post status changes

### NOT Working / Not Implemented:
1. Pages publishing
2. Products publishing (WooCommerce)
3. Product Categories/Tags sync
4. Two-way content sync (Hybrid Mode)
5. Keywords sync
6. Writers sync
7. Module-based enable/disable
8. Internal linking automation (Linker)
9. Audits & Scores (Optimizer)

---

---

# IMPLEMENTATION PLAN

---

## Phase 1: WordPress Plugin Updates

### 1.1 Controls Page Redesign → Rename to "Settings"

#### New Structure:

**Section A: Post Types** (Top level toggles)
```
┌─────────────────────────────────────────────────────────────┐
│  POST TYPES                                                  │
├─────────────────────────────────────────────────────────────┤
│  ☑ Posts                                                    │
│  ☐ Pages                                    [Coming Soon]    │
│  ☐ Products (WooCommerce)                   [Coming Soon]    │
│  ☐ {Other detected CPTs}                    [Coming Soon]    │
└─────────────────────────────────────────────────────────────┘
```

- Auto-detect ALL registered post types in WordPress
- Show toggle for each post type
- "Coming Soon" badge on ALL post types except Posts
- Keep all toggles functional for now (testing) - will disable later
- Only show taxonomy cards below for ENABLED post types

**Section B: Post Type Cards** (Conditional - only shown if post type is enabled)

For each enabled post type, show a separate card with its taxonomies:

```
┌─────────────────────────────────────────────────────────────┐
│  📝 POSTS                                                    │
├─────────────────────────────────────────────────────────────┤
│  Taxonomies:                                                 │
│  ☑ Categories                                               │
│  ☑ Tags                                                     │
│  ☑ IGNY8 Sectors                                            │
│  ☑ IGNY8 Clusters                                           │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│  📦 PRODUCTS                                 [Coming Soon]   │
├─────────────────────────────────────────────────────────────┤
│  Taxonomies:                                                 │
│  ☑ Product Categories                                       │
│  ☑ Product Tags                                             │
│  ☑ IGNY8 Sectors                                            │
│  ☑ IGNY8 Clusters                                           │
│  ☐ Product Shipping Classes                                 │
│  ☐ Brands                                                   │
│  ☐ {Other product attributes/taxonomies}                    │
└─────────────────────────────────────────────────────────────┘
```

- Auto-detect ALL taxonomies registered for each post type
- For Products: auto-detect all WooCommerce attributes and taxonomies
- Default enabled: Categories, Tags, Product Categories, Product Tags, IGNY8 Sectors, IGNY8 Clusters
- Default disabled: All other detected taxonomies
- Remove "Expired" taxonomy (this was created by our plugin in error - delete it)

**Section C: Other Settings**
```
┌─────────────────────────────────────────────────────────────┐
│  DEFAULT SETTINGS                                            │
├─────────────────────────────────────────────────────────────┤
│  Default Post Status: [Draft ▼]                             │
│  Enable IGNY8 Sync:   ☑ ON                                  │
└─────────────────────────────────────────────────────────────┘
```

### 1.2 Items to REMOVE from Plugin

1. **Control Mode** (Mirror/Hybrid) - doesn't do anything, misleading
2. **IGNY8 Modules checkboxes** - doesn't do anything, misleading
3. **Sync History for Keywords** - not implemented
4. **Sync History for Writers** - not implemented
5. **Scheduled Syncs section** - rarely used, confusing
6. **"Expired" taxonomy** - created in error by plugin, remove it

### 1.3 UI Terminology Changes

| Current | New |
|---------|-----|
| Controls | Settings |
| Sync | Connection |
| Sync History | Last Updated |
| Data | Link Queue (if Linker enabled) or hide |

### 1.4 Technical Implementation Notes

```php
// Auto-detect post types
$post_types = get_post_types(array('public' => true), 'objects');

// Auto-detect taxonomies for each post type
foreach ($post_types as $post_type) {
    $taxonomies = get_object_taxonomies($post_type->name, 'objects');
}

// For WooCommerce Products, also get attributes
if (class_exists('WooCommerce')) {
    $attributes = wc_get_attribute_taxonomies();
}
```

---

## Phase 2: IGNY8 App Updates

### 2.1 Site Content Page Updates (`/sites/{id}/content`)

#### A) Post Type Filters (Top Bar)

Add post type selector buttons above the content list:
- Only show if there are more than 1 post type enabled in WordPress plugin
- Show buttons like: `Posts` | `Products` | `Services` | etc.
- Default to "Posts"
- Filter content by selected post type

```
┌─────────────────────────────────────────────────────────────┐
│  Posts  │  Products  │  Services                            │
├─────────────────────────────────────────────────────────────┤
│  [Filters...]                        [Content Types]        │
├─────────────────────────────────────────────────────────────┤
│  Content list...                                            │
└─────────────────────────────────────────────────────────────┘
```

#### B) Content Types Button

Add "Content Types" button on the far right of the same row as post type filters:
- Opens a modal/drawer showing WordPress content structure
- This replaces the "Content Types" tab in Site Settings

### 2.2 New Content Structure Page (Full Page)

**Route:** `/sites/{id}/content/structure`

**Purpose:** Show site's content structure organized by Clusters - FULL PAGE, not modal

**Layout:**

```
┌─────────────────────────────────────────────────────────────┐
│  SITE > CONTENT > STRUCTURE                                 │
├─────────────────────────────────────────────────────────────┤
│  Cluster: [Select Cluster ▼]                                │
├─────────────────────────────────────────────────────────────┤
│  (When cluster selected, show:)                             │
│                                                             │
│  Keywords in this Cluster:                                  │
│  ┌─────────────────────────────────────────────────────────┐
│  │ Keyword Name                          │ Content Count   │
│  ├─────────────────────────────────────────────────────────┤
│  │ AI Content Writing                    │ 12              │
│  │ Blog Automation Tools                 │ 8               │
│  │ SEO Content Strategy                  │ 5               │
│  └─────────────────────────────────────────────────────────┘
│                                                             │
│  Cluster Content:                                           │
│  (REUSE existing component from /planner/clusters/{id})     │
│  - View Live link                                           │
│  - View in App link                                         │
│  - Edit link                                                │
│  - Published/Pending/Draft counts                           │
│  - Content list with same styling                           │
└─────────────────────────────────────────────────────────────┘
```

**Key Features:**
- Full page with proper URL: `/sites/{id}/content/structure`
- Cluster selector dropdown at top
- Keywords list with content counts for selected cluster
- **REUSE** existing content list component from cluster detail page (`/planner/clusters/{id}`)
- Same functionality: View Live, View in App, Edit links
- Shows content stats and articles list

### 2.3 Remove from Site Settings Page

1. **Remove "Content Types" tab** from Site Settings
2. Only track content/terms that IGNY8 is publishing/using

### 2.4 Content & Taxonomy Tracking (KEEP & IMPROVE)

**IMPORTANT:** Do NOT break existing publishing and tracking systems.

**What We Track (KEEP):**
- Content published by IGNY8 against Clusters
- Content published by IGNY8 against Keywords
- IGNY8 Clusters taxonomy on WordPress (created/synced by plugin)
- IGNY8 Sectors taxonomy on WordPress (created/synced by plugin)
- Categories and Tags used by published content

**Improvements:**
- Validate IGNY8 Clusters taxonomy sync between app and WordPress
- Validate IGNY8 Sectors taxonomy sync between app and WordPress
- Ensure counts match on both local app and remote WordPress site
- Content tracking against clusters/keywords is critical for:
  - Future optimization
  - Content rewriting
  - Content extension
  - Performance analytics

### 2.5 Bulk Structure Syncing (SIMPLIFY, NOT REMOVE)

**KEEP:**
- Syncing of IGNY8 Clusters taxonomy
- Syncing of IGNY8 Sectors taxonomy
- Categories/Tags used by IGNY8 published content
- Content counts against clusters/keywords

**REMOVE:**
- Full WordPress site structure dump (all post types, all taxonomies)
- Counts of content not managed by IGNY8
- Periodic full re-sync of entire site structure

**Principle:** Only track what IGNY8 creates/publishes, not entire WordPress site.

---

## Phase 3: Summary of Changes

### WordPress Plugin Changes:
| Item | Action |
|------|--------|
| Controls page | Rename to "Settings", redesign |
| Post Types | Auto-detect all, show toggles, "Coming Soon" on all except Posts |
| Taxonomies | Group under post type cards, auto-detect all |
| Control Mode | REMOVE |
| IGNY8 Modules | REMOVE |
| Expired taxonomy | DELETE (was created in error) |
| Sync History (Keywords, Writers) | REMOVE |
| Scheduled Syncs | REMOVE |
| Data page | Keep for Linker queue only |

### IGNY8 App Changes:
| Item | Action |
|------|--------|
| `/sites/{id}/content` | Add post type filter buttons |
| Content Types button | Add to content page → links to `/sites/{id}/content/structure` |
| Content Structure page | New full page at `/sites/{id}/content/structure` |
| Site Settings > Content Types tab | REMOVE |
| Bulk structure syncing | SIMPLIFY - only track IGNY8-managed content |
| IGNY8 Clusters/Sectors sync | KEEP & VALIDATE - ensure app ↔ WordPress match |
| Content tracking (clusters/keywords) | KEEP - critical for optimization/rewriting |

### What Still Works (No Changes):
1. Publishing Posts to WordPress ✅
2. Categories sync ✅
3. Tags sync ✅
4. IGNY8 Sectors sync ✅
5. IGNY8 Clusters sync ✅
6. Featured images ✅
7. In-article images ✅
8. Post status webhooks ✅
9. Content tracking against Clusters ✅
10. Content tracking against Keywords ✅

---

## Implementation Checklist

### WordPress Plugin:
- [ ] Rename "Controls" to "Settings"
- [ ] Add post type auto-detection
- [ ] Add post type toggles with "Coming Soon" badges
- [ ] Create taxonomy cards for each enabled post type
- [ ] Auto-detect all taxonomies per post type
- [ ] Auto-detect WooCommerce attributes for Products
- [ ] Set default enabled taxonomies (Categories, Tags, Product Categories, Product Tags, Sectors, Clusters)
- [ ] Remove Control Mode section
- [ ] Remove IGNY8 Modules section
- [ ] Remove "Expired" taxonomy
- [ ] Remove Keywords/Writers from Sync History
- [ ] Remove Scheduled Syncs section
- [ ] Simplify Sync page → Connection page

### IGNY8 App:
- [ ] Add post type filter buttons to `/sites/{id}/content`
- [ ] Only show if >1 post type enabled
- [ ] Add "Structure" button (far right) → links to `/sites/{id}/content/structure`
- [ ] Create Content Structure page at `/sites/{id}/content/structure`
- [ ] Add cluster selector dropdown
- [ ] Show keywords with content counts
- [ ] REUSE content list component from `/planner/clusters/{id}`
- [ ] Remove Content Types tab from Site Settings
- [ ] Simplify bulk structure syncing (keep IGNY8 clusters/sectors only)
- [ ] Validate IGNY8 Clusters taxonomy sync (app ↔ WordPress)
- [ ] Validate IGNY8 Sectors taxonomy sync (app ↔ WordPress)
- [ ] Keep content tracking against clusters/keywords (DO NOT BREAK)

---

## Notes

- All post types except Posts show "Coming Soon" but remain configurable for testing
- Later: disable non-Posts post types after production testing
- Publishing flow MUST continue working throughout changes
- No changes to the actual publishing API endpoints
- **CRITICAL:** Content tracking against Clusters and Keywords must remain intact
- **CRITICAL:** IGNY8 Clusters and Sectors taxonomy sync must be validated and working
- Reuse existing components where possible (content list from cluster detail page)