358 lines
11 KiB
Markdown
358 lines
11 KiB
Markdown
# Debugging Guide - December 1, 2025
|
|
|
|
## Issues to Fix
|
|
|
|
### Issue 1: Status Not Changing from 'review' to 'published'
|
|
**Symptom:** Content stays in "review" status in IGNY8 app after clicking Publish button
|
|
|
|
**What to check:**
|
|
1. Go to https://app.igny8.com/settings/debug-status
|
|
2. Click "Publish" on a content item in Review page
|
|
3. Look for these log messages in IGNY8 backend logs:
|
|
- `[publish_content_to_wordpress] 📦 Preparing content payload...`
|
|
- `Content status: 'review'` or `'published'`
|
|
- `💾 Content model updated: Status: 'X' → 'published'`
|
|
|
|
**Expected flow:**
|
|
1. User clicks Publish → Status immediately changes to 'published' in IGNY8
|
|
2. Celery task queues WordPress publish
|
|
3. WordPress responds with post_id and post_url
|
|
4. IGNY8 updates external_id and external_url
|
|
|
|
### Issue 2: No WP Status Column on Published Page
|
|
**Symptom:** Published page doesn't show WordPress post status
|
|
|
|
**What to check:**
|
|
- Call: `GET https://app.igny8.com/api/v1/writer/content/{id}/wordpress_status/`
|
|
- Expected response:
|
|
```json
|
|
{
|
|
"success": true,
|
|
"data": {
|
|
"wordpress_status": "publish",
|
|
"external_id": 123,
|
|
"external_url": "https://site.com/post",
|
|
"post_title": "...",
|
|
"last_checked": "2025-12-01T..."
|
|
}
|
|
}
|
|
```
|
|
|
|
**WordPress endpoint:**
|
|
- `GET https://yoursite.com/wp-json/igny8/v1/post-status/{post_id}/`
|
|
|
|
### Issue 3: Custom Taxonomy/Attribute Columns Still Showing
|
|
**Symptom:** WordPress admin shows "Taxonomy" and "Attribute" columns
|
|
|
|
**What to check:**
|
|
1. Go to WordPress admin → Posts → All Posts
|
|
2. Check column headers
|
|
3. Should ONLY see: Title, Author, Categories, Tags, Date
|
|
4. Should NOT see: Taxonomy, Attribute
|
|
|
|
**If still showing:** Clear WordPress object cache and refresh page
|
|
|
|
### Issue 4: Tags, Categories, Images Not Saving
|
|
**Symptom:** WordPress posts don't have tags, categories, or images after publishing
|
|
|
|
**What to check in logs:**
|
|
|
|
#### IGNY8 Backend Logs (Celery worker output):
|
|
```
|
|
[publish_content_to_wordpress] Found X taxonomy mappings
|
|
[publish_content_to_wordpress] 📁 Added category: 'Category Name'
|
|
[publish_content_to_wordpress] Found X images for content
|
|
[publish_content_to_wordpress] 🖼️ Featured image: https://...
|
|
[publish_content_to_wordpress] 🏷️ Primary keyword (tag): 'keyword'
|
|
[publish_content_to_wordpress] 📊 TOTAL: X categories, Y tags
|
|
[publish_content_to_wordpress] 📦 Payload summary:
|
|
- Categories: [...]
|
|
- Tags: [...]
|
|
- Featured image: Yes
|
|
- Gallery images: N
|
|
```
|
|
|
|
#### WordPress Logs (debug.log):
|
|
```
|
|
========== IGNY8 PUBLISH REQUEST ==========
|
|
Content ID: 123
|
|
Categories: ["Category1","Category2"]
|
|
Tags: ["tag1","tag2","tag3"]
|
|
Featured Image: https://...
|
|
Gallery Images: 2 images
|
|
===========================================
|
|
|
|
========== IGNY8 CREATE WP POST ==========
|
|
IGNY8: Processing 2 categories
|
|
IGNY8: ✅ Assigned 2 categories to post 456
|
|
IGNY8: Processing 3 tags
|
|
IGNY8: ✅ Assigned 3 tags to post 456
|
|
IGNY8: Setting featured image from featured_image_url field: https://...
|
|
IGNY8: Setting gallery with 2 images
|
|
IGNY8: Setting SEO meta title: ...
|
|
========== IGNY8 POST CREATION COMPLETE: Post ID 456 ==========
|
|
```
|
|
|
|
## How to Enable Logging
|
|
|
|
### IGNY8 Backend
|
|
1. Celery logs are automatically output to console
|
|
2. Run Celery worker with: `celery -A igny8_core worker -l info`
|
|
3. Or check Docker logs: `docker logs -f igny8_celery`
|
|
|
|
### WordPress
|
|
1. Enable debug mode in `wp-config.php`:
|
|
```php
|
|
define('WP_DEBUG', true);
|
|
define('WP_DEBUG_LOG', true);
|
|
define('WP_DEBUG_DISPLAY', false);
|
|
```
|
|
|
|
2. Check logs at: `wp-content/debug.log`
|
|
|
|
3. Tail logs in real-time:
|
|
```bash
|
|
tail -f wp-content/debug.log
|
|
```
|
|
|
|
## Test Procedure
|
|
|
|
### Test Case 1: Publish Content with Full Metadata
|
|
1. Create content in IGNY8 with:
|
|
- Title: "Test Content Dec 1"
|
|
- Content HTML: Full article body
|
|
- ContentTaxonomyMap: Link to taxonomy term "Marketing"
|
|
- Primary Keyword: "seo strategy"
|
|
- Secondary Keywords: ["digital marketing", "content marketing"]
|
|
- Images: 1 featured, 2 gallery
|
|
|
|
2. Click Publish button
|
|
|
|
3. Check IGNY8 logs for:
|
|
- ✅ Categories extracted: Should see "Marketing"
|
|
- ✅ Tags extracted: Should see "seo strategy", "digital marketing", "content marketing"
|
|
- ✅ Images extracted: Should see featured + 2 gallery
|
|
- ✅ Status changed to 'published'
|
|
|
|
4. Check WordPress logs for:
|
|
- ✅ Received categories array with "Marketing"
|
|
- ✅ Received tags array with 3 items
|
|
- ✅ Received featured_image_url
|
|
- ✅ Received gallery_images array with 2 items
|
|
- ✅ Post created with ID
|
|
- ✅ Categories assigned
|
|
- ✅ Tags assigned
|
|
- ✅ Images downloaded and attached
|
|
|
|
5. Check WordPress admin:
|
|
- Go to Posts → All Posts
|
|
- Find the post "Test Content Dec 1"
|
|
- Open it for editing
|
|
- Verify:
|
|
- ✅ Categories: "Marketing" is checked
|
|
- ✅ Tags: "seo strategy", "digital marketing", "content marketing" appear
|
|
- ✅ Featured image is set
|
|
- ✅ Gallery images are in media library
|
|
|
|
### Test Case 2: Check Status Sync
|
|
1. Publish content from IGNY8
|
|
2. Immediately check IGNY8 app → Published page
|
|
3. ✅ Content should appear with status "Published"
|
|
4. Call WordPress status endpoint
|
|
5. ✅ Should return wordpress_status: "publish"
|
|
|
|
## Common Issues
|
|
|
|
### Issue: No categories/tags being sent
|
|
**Diagnosis:**
|
|
- Check IGNY8 logs for: `Found 0 taxonomy mappings`
|
|
- Check IGNY8 logs for: `No primary keyword found`
|
|
|
|
**Solution:**
|
|
- Ensure Content has ContentTaxonomyMap entries
|
|
- Ensure Content has primary_keyword and secondary_keywords populated
|
|
|
|
### Issue: Images not appearing
|
|
**Diagnosis:**
|
|
- Check IGNY8 logs for: `Found 0 images for content`
|
|
|
|
**Solution:**
|
|
- Ensure Images model has records linked to content
|
|
- Ensure Images have image_url populated
|
|
- Ensure Images have correct image_type ('featured' or 'in_article')
|
|
|
|
### Issue: WordPress receives empty arrays
|
|
**Diagnosis:**
|
|
- WordPress logs show: `Categories: []`, `Tags: []`
|
|
|
|
**Solution:**
|
|
- This means IGNY8 backend is not extracting data from Content model
|
|
- Check that Content.id matches the one being published
|
|
- Check that ContentTaxonomyMap.content_id matches Content.id
|
|
- Check that Images.content_id matches Content.id
|
|
|
|
### Issue: Status not updating in IGNY8
|
|
**Diagnosis:**
|
|
- IGNY8 logs show status change but app still shows "review"
|
|
|
|
**Solution:**
|
|
- Check if frontend is polling/refreshing after publish
|
|
- Check if Content.status field is actually being saved
|
|
- Check database directly: `SELECT id, title, status FROM content_content WHERE id = X;`
|
|
|
|
## Database Queries for Debugging
|
|
|
|
### Check Content Status
|
|
```sql
|
|
SELECT
|
|
id,
|
|
title,
|
|
status,
|
|
external_id,
|
|
external_url,
|
|
primary_keyword,
|
|
secondary_keywords
|
|
FROM content_content
|
|
WHERE id = YOUR_CONTENT_ID;
|
|
```
|
|
|
|
### Check Taxonomy Mappings
|
|
```sql
|
|
SELECT
|
|
ctm.id,
|
|
ctm.content_id,
|
|
t.name as taxonomy_name
|
|
FROM content_contenttaxonomymap ctm
|
|
JOIN content_taxonomy t ON ctm.taxonomy_id = t.id
|
|
WHERE ctm.content_id = YOUR_CONTENT_ID;
|
|
```
|
|
|
|
### Check Images
|
|
```sql
|
|
SELECT
|
|
id,
|
|
content_id,
|
|
image_type,
|
|
image_url,
|
|
position
|
|
FROM writer_images
|
|
WHERE content_id = YOUR_CONTENT_ID
|
|
ORDER BY position;
|
|
```
|
|
|
|
### Check WordPress Post Meta
|
|
```sql
|
|
-- In WordPress database
|
|
SELECT
|
|
post_id,
|
|
meta_key,
|
|
meta_value
|
|
FROM wp_postmeta
|
|
WHERE post_id = YOUR_POST_ID
|
|
AND meta_key LIKE '_igny8_%';
|
|
```
|
|
|
|
### Check WordPress Post Terms
|
|
```sql
|
|
-- In WordPress database
|
|
SELECT
|
|
tr.object_id as post_id,
|
|
tt.taxonomy,
|
|
t.name as term_name
|
|
FROM wp_term_relationships tr
|
|
JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
|
|
JOIN wp_terms t ON tt.term_id = t.term_id
|
|
WHERE tr.object_id = YOUR_POST_ID;
|
|
```
|
|
|
|
## Next Steps
|
|
|
|
1. **Test with sample content** following Test Case 1 above
|
|
2. **Collect all log output** from both IGNY8 and WordPress
|
|
3. **Share logs** for analysis if issues persist
|
|
4. **Check database** using queries above to verify data exists
|
|
|
|
## Log Locations
|
|
|
|
### IGNY8 Backend
|
|
- Celery worker console output
|
|
- Docker logs: `docker logs igny8_celery`
|
|
- Django logs: `igny8/backend/logs/` (if configured)
|
|
|
|
### WordPress
|
|
- `wp-content/debug.log`
|
|
- Apache/Nginx error logs
|
|
- PHP error logs
|
|
|
|
## Expected Log Flow
|
|
|
|
When everything works correctly, you should see this sequence:
|
|
|
|
**1. IGNY8 Backend (when Publish clicked):**
|
|
```
|
|
[ContentViewSet.publish] Queued Celery task abc-123 for content 456, status set to 'published'
|
|
[publish_content_to_wordpress] 🎯 Celery task started: content_id=456
|
|
[publish_content_to_wordpress] 📄 Content loaded: title='Test Article'
|
|
[publish_content_to_wordpress] Found 2 taxonomy mappings
|
|
[publish_content_to_wordpress] 📁 Added category: 'Marketing'
|
|
[publish_content_to_wordpress] 📁 Added category: 'Technology'
|
|
[publish_content_to_wordpress] Found 3 images for content
|
|
[publish_content_to_wordpress] 🖼️ Featured image: https://...
|
|
[publish_content_to_wordpress] 🖼️ Gallery image #1: https://...
|
|
[publish_content_to_wordpress] 🖼️ Gallery image #2: https://...
|
|
[publish_content_to_wordpress] 🏷️ Primary keyword (tag): 'seo strategy'
|
|
[publish_content_to_wordpress] 🏷️ Added 2 secondary keywords as tags
|
|
[publish_content_to_wordpress] 📊 TOTAL: 2 categories, 3 tags
|
|
[publish_content_to_wordpress] 🚀 POSTing to WordPress: https://site.com/wp-json/...
|
|
[publish_content_to_wordpress] 📦 Payload summary:
|
|
- Categories: ['Marketing', 'Technology']
|
|
- Tags: ['seo strategy', 'digital marketing', 'content marketing']
|
|
- Featured image: Yes
|
|
- Gallery images: 2
|
|
[publish_content_to_wordpress] 📬 WordPress response: status=201
|
|
[publish_content_to_wordpress] ✅ WordPress post created successfully: post_id=789
|
|
[publish_content_to_wordpress] 💾 Content model updated:
|
|
- Status: 'published' → 'published'
|
|
- External ID: 789
|
|
- External URL: https://site.com/test-article/
|
|
[publish_content_to_wordpress] 🎉 Successfully published content 456 to WordPress post 789
|
|
```
|
|
|
|
**2. WordPress (receiving publish request):**
|
|
```
|
|
========== IGNY8 PUBLISH REQUEST ==========
|
|
Content ID: 456
|
|
Task ID: 123
|
|
Title: Test Article
|
|
Content HTML: 5234 chars
|
|
Categories: ["Marketing","Technology"]
|
|
Tags: ["seo strategy","digital marketing","content marketing"]
|
|
Featured Image: https://...
|
|
Gallery Images: 2 images
|
|
SEO Title: YES
|
|
SEO Description: YES
|
|
Primary Keyword: seo strategy
|
|
===========================================
|
|
|
|
========== IGNY8 CREATE WP POST ==========
|
|
Content ID: 456
|
|
Task ID: 123
|
|
Title: Test Article
|
|
IGNY8: Processing 2 categories
|
|
IGNY8: ✅ Assigned 2 categories to post 789
|
|
IGNY8: Processing 3 tags
|
|
IGNY8: ✅ Assigned 3 tags to post 789
|
|
IGNY8: Setting featured image from featured_image_url field: https://...
|
|
IGNY8: Setting gallery with 2 images
|
|
IGNY8: Setting SEO meta title: Test Article - SEO Title
|
|
IGNY8: Setting SEO meta description
|
|
========== IGNY8 POST CREATION COMPLETE: Post ID 789 ==========
|
|
```
|
|
|
|
If you don't see these logs, something is broken in the flow.
|
|
|
|
---
|
|
|
|
**Created:** December 1, 2025
|
|
**Purpose:** Diagnose why fixes didn't work and provide step-by-step debugging
|