Major refactoring to create a clean, integrated CLI application: ### New Features: - Unified CLI executable (./seo) with simple command structure - All commands accept optional CSV file arguments - Auto-detection of latest files when no arguments provided - Simplified output directory structure (output/ instead of output/reports/) - Cleaner export filename format (all_posts_YYYY-MM-DD.csv) ### Commands: - export: Export all posts from WordPress sites - analyze [csv]: Analyze posts with AI (optional CSV input) - recategorize [csv]: Recategorize posts with AI - seo_check: Check SEO quality - categories: Manage categories across sites - approve [files]: Review and approve recommendations - full_pipeline: Run complete workflow - analytics, gaps, opportunities, report, status ### Changes: - Moved all scripts to scripts/ directory - Created config.yaml for configuration - Updated all scripts to use output/ directory - Deprecated old seo-cli.py in favor of new ./seo - Added AGENTS.md and CHANGELOG.md documentation - Consolidated README.md with updated usage ### Technical: - Added PyYAML dependency - Removed hardcoded configuration values - All scripts now properly integrated - Better error handling and user feedback Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
289 lines
6.6 KiB
Markdown
289 lines
6.6 KiB
Markdown
# Rank Math REST API Configuration - Complete Guide
|
|
|
|
## The Problem
|
|
|
|
Rank Math meta fields (`rank_math_description`, `rank_math_title`, etc.) are not exposed in the WordPress REST API by default. Our SEO analyzer needs these fields to be available.
|
|
|
|
## Solution: Enable REST API in Rank Math
|
|
|
|
### Step 1: Go to Rank Math Settings
|
|
|
|
In WordPress Admin:
|
|
```
|
|
Rank Math → Settings → Advanced
|
|
```
|
|
|
|
### Step 2: Find REST API Section
|
|
|
|
Look for one of these options:
|
|
- **"REST API"** - Enable
|
|
- **"Expose in REST API"** - Check/Enable
|
|
- **"API"** - Look for REST API toggle
|
|
- **"Integrations"** - REST API section
|
|
|
|
### Step 3: Enable All Rank Math Fields
|
|
|
|
Make sure these are exposed:
|
|
- ✓ SEO Title (`rank_math_title`)
|
|
- ✓ SEO Description (`rank_math_description`)
|
|
- ✓ Focus Keyword (`rank_math_focus_keyword`)
|
|
- ✓ Canonical URL (`rank_math_canonical_url`)
|
|
|
|
### Step 4: Save Changes
|
|
|
|
Click **Save** and wait for confirmation.
|
|
|
|
---
|
|
|
|
## Verify It Works
|
|
|
|
### Test 1: Use curl
|
|
|
|
Run this command (replace credentials and domain):
|
|
|
|
```bash
|
|
curl -u "your_username:your_app_password" \
|
|
"https://www.mistergeek.net/wp-json/wp/v2/posts?per_page=1&status=publish" \
|
|
| jq '.[] | .meta | keys'
|
|
```
|
|
|
|
**You should see:**
|
|
```json
|
|
[
|
|
"rank_math_description",
|
|
"rank_math_title",
|
|
"rank_math_focus_keyword",
|
|
...other fields...
|
|
]
|
|
```
|
|
|
|
If you see Rank Math fields: ✓ **SUCCESS!**
|
|
|
|
If you don't see them: ⚠️ **Rank Math REST API not enabled yet**
|
|
|
|
### Test 2: Run Diagnostic Again
|
|
|
|
```bash
|
|
python scripts/multi_site_seo_analyzer.py --diagnose https://www.mistergeek.net
|
|
```
|
|
|
|
**Look for:**
|
|
```
|
|
Available meta fields:
|
|
• rank_math_description: Your SEO description...
|
|
• rank_math_title: Your SEO title...
|
|
• rank_math_focus_keyword: your keyword
|
|
```
|
|
|
|
---
|
|
|
|
## If REST API Still Not Working
|
|
|
|
### Check 1: Rank Math Version
|
|
|
|
Make sure you have **latest Rank Math version**:
|
|
```
|
|
WordPress Admin → Plugins → Rank Math SEO
|
|
Check version number, update if available
|
|
```
|
|
|
|
### Check 2: WordPress Version Compatibility
|
|
|
|
Rank Math REST API support requires:
|
|
- ✓ WordPress 5.0+
|
|
- ✓ Rank Math 1.0.50+
|
|
|
|
If older: **Update both WordPress and Rank Math**
|
|
|
|
### Check 3: User Permissions
|
|
|
|
Your WordPress user must have:
|
|
- ✓ **Administrator** or **Editor** role
|
|
- ✓ `edit_posts` capability
|
|
- ✓ `read_posts` capability
|
|
|
|
Try with **Administrator** account if unsure.
|
|
|
|
### Check 4: Security Plugin Blocking
|
|
|
|
Some security plugins block REST API:
|
|
- Wordfence
|
|
- Sucuri
|
|
- iThemes Security
|
|
- All in One WP Security
|
|
|
|
**Try temporarily disabling** to test:
|
|
```
|
|
WordPress Admin → Plugins → Deactivate [Security Plugin]
|
|
Run diagnostic
|
|
Re-enable plugin
|
|
```
|
|
|
|
If diagnostic works after disabling: **The security plugin is blocking REST API**
|
|
|
|
**Fix:** Whitelist your IP in security plugin settings, or contact plugin support.
|
|
|
|
### Check 5: Server Configuration
|
|
|
|
Some hosting limits REST API:
|
|
- GoDaddy (sometimes)
|
|
- Bluehost (sometimes)
|
|
- Cheap shared hosting
|
|
|
|
**Test with curl:**
|
|
```bash
|
|
curl "https://www.mistergeek.net/wp-json/"
|
|
```
|
|
|
|
Should return API info. If 403/404: **Contact hosting provider**
|
|
|
|
---
|
|
|
|
## Alternative: Use Rank Math API Manager Plugin
|
|
|
|
If the above doesn't work, you can use the **Rank Math API Manager** plugin:
|
|
|
|
1. **Install plugin:**
|
|
- GitHub: https://github.com/devora-as/rank-math-api-manager
|
|
- Or search "Rank Math API Manager" in WordPress plugin directory
|
|
|
|
2. **Activate plugin:**
|
|
```
|
|
WordPress Admin → Plugins → Activate Rank Math API Manager
|
|
```
|
|
|
|
3. **Configure:**
|
|
- Plugin provides custom REST API endpoints
|
|
- Our script can be updated to use these endpoints
|
|
|
|
4. **Contact us** if you want to integrate this approach
|
|
|
|
---
|
|
|
|
## Complete Checklist
|
|
|
|
Before running analyzer:
|
|
|
|
- [ ] Installed Rank Math SEO (latest version)
|
|
- [ ] WordPress 5.0+
|
|
- [ ] Rank Math 1.0.50+
|
|
- [ ] Admin/Editor user account
|
|
- [ ] Rank Math REST API enabled in settings
|
|
- [ ] Verified with diagnostic command
|
|
- [ ] Verified with curl command
|
|
- [ ] No security plugin blocking REST API
|
|
- [ ] Hosting supports REST API
|
|
|
|
## Quick Troubleshooting
|
|
|
|
| Symptom | Cause | Fix |
|
|
|---------|-------|-----|
|
|
| No `rank_math_*` fields in diagnostic | REST API not enabled | Enable in Rank Math Settings → Advanced |
|
|
| 401 Unauthorized error | Wrong credentials | Verify username and app password |
|
|
| 403 Forbidden | User lacks permissions | Use Administrator account |
|
|
| 404 error | REST API blocked | Check security plugin or hosting |
|
|
| Empty meta fields | Rank Math not setting meta | Check if posts have Rank Math data in admin |
|
|
|
|
---
|
|
|
|
## Step-by-Step Setup (Visual Guide)
|
|
|
|
### Step 1: Login to WordPress Admin
|
|
```
|
|
https://www.mistergeek.net/wp-admin/
|
|
```
|
|
|
|
### Step 2: Go to Rank Math Settings
|
|
```
|
|
Left menu → Rank Math → Settings
|
|
```
|
|
|
|
### Step 3: Find Advanced Tab
|
|
```
|
|
Tabs: Dashboard | Wizards | Analytics | Content AI | Settings | Tools
|
|
Click: Settings
|
|
Sub-tabs: General | Advanced | Integrations
|
|
Click: Advanced
|
|
```
|
|
|
|
### Step 4: Find REST API Section
|
|
```
|
|
Look for: "REST API" heading or toggle
|
|
Sub-options: "Expose in REST API" checkboxes
|
|
```
|
|
|
|
### Step 5: Enable Checkboxes
|
|
```
|
|
✓ Expose SEO Title in REST API
|
|
✓ Expose SEO Description in REST API
|
|
✓ Expose Focus Keyword in REST API
|
|
✓ Expose Canonical URL in REST API
|
|
```
|
|
|
|
### Step 6: Save
|
|
```
|
|
Click: Save button at bottom
|
|
Wait for: "Settings saved" message
|
|
```
|
|
|
|
### Step 7: Test
|
|
```
|
|
Terminal: python scripts/multi_site_seo_analyzer.py --diagnose https://www.mistergeek.net
|
|
Look for: rank_math_description in output
|
|
```
|
|
|
|
---
|
|
|
|
## If You Find Different Settings
|
|
|
|
Rank Math UI changes between versions. If the above steps don't match your screen:
|
|
|
|
**Search in Rank Math:**
|
|
```
|
|
1. Open Rank Math → Settings
|
|
2. Use browser Find (Ctrl+F or Cmd+F)
|
|
3. Search for: "REST" or "API"
|
|
4. Follow the UI from there
|
|
```
|
|
|
|
---
|
|
|
|
## After Enabling REST API
|
|
|
|
1. **Run diagnostic:**
|
|
```bash
|
|
python scripts/multi_site_seo_analyzer.py --diagnose https://www.mistergeek.net
|
|
```
|
|
|
|
2. **Should see:**
|
|
```
|
|
Available meta fields:
|
|
• rank_math_description: Your description here...
|
|
• rank_math_title: Your title...
|
|
• rank_math_focus_keyword: keyword
|
|
```
|
|
|
|
3. **Then run analyzer:**
|
|
```bash
|
|
python scripts/multi_site_seo_analyzer.py --include-drafts --top-n 50
|
|
```
|
|
|
|
4. **Meta descriptions will now be detected!**
|
|
|
|
---
|
|
|
|
## Next Steps
|
|
|
|
1. **Go to Rank Math settings** and enable REST API
|
|
2. **Run diagnostic** to verify:
|
|
```bash
|
|
python scripts/multi_site_seo_analyzer.py --diagnose https://www.mistergeek.net
|
|
```
|
|
3. **If successful**, run full analyzer:
|
|
```bash
|
|
python scripts/multi_site_seo_analyzer.py --include-drafts --top-n 50
|
|
```
|
|
4. **Share the diagnostic output** if you're still having issues
|
|
|
|
Let me know when you've enabled REST API in Rank Math! 🚀
|