Prerequisites: WP-CLI must be installed on your server. Learn more
includes/class-geoai-cli.php
Installation Check
Verify GEO AI’s CLI commands are registered:Commands
wp geoai audit
Run SEO audits on posts via command line.
- Single Post
- All Posts
- Filtered Audit
Audit a specific post by ID:Output:Parameters:
<post_id>- WordPress post ID (required)
- Retrieves post content
- Runs
GeoAI_Analyzer::analyze_post() - Displays total score and all issues
- Exits with code 0 on success, 1 on error
Implementation Details
Source Code
Error Handling
Usage Examples
Bulk Audit for Reporting
Audit all posts and save output to CSV:Scheduled Audits
Add to crontab for weekly SEO health checks:CI/CD Integration
Run audits in deployment pipeline:Quality Gates
Reject posts below quality threshold:Performance Considerations
API Rate Limits
Each audit calls Google Gemini API. Free tier limits:
- 60 requests/minute
- 1,500 requests/day
Memory Usage
Bulk audits load all posts into memory. For 1000+ posts:
Progress Tracking
WP-CLI shows progress bars automatically:
Batch Processing
For very large sites (5000+ posts):
Output Formats
Success Message
Error Messages
Issue Severity Levels
| Prefix | Severity | Color (in terminal) |
|---|---|---|
[error] | High priority fix | Red |
[warning] | Should fix | Yellow |
[ok] | Acceptable | Blue |
[good] | Performing well | Green |
Extending WP-CLI
Add custom subcommands to GEO AI:Planned Commands (v1.1+)
The following commands are planned but not yet implemented:
wp geoai fix
Apply automated quick fixes:
wp geoai report
Generate SEO health reports:
wp geoai clear-cache
Clear analyzer caches:
wp geoai settings
Manage settings via CLI:
Troubleshooting
Command not found
Command not found
Error:
Error: 'geoai' is not a registered wp command.Solutions:- Verify GEO AI is active:
wp plugin list - Check if WP-CLI constant is defined in CLI context
- Ensure
class-geoai-cli.phpis loaded - Try:
wp cli cache clear
API timeout on bulk audits
API timeout on bulk audits
Error:
Error: Failed to analyze post: API request timed out.Solutions:- Add delays between requests (see Performance section)
- Increase PHP timeout:
--extra-php="-d max_execution_time=300" - Use smaller batches instead of
audit all - Check Gemini API quota in Google Cloud Console
Memory exhausted
Memory exhausted
Error:
Fatal error: Allowed memory size exhaustedSolutions:- Increase memory:
--extra-php="-d memory_limit=512M" - Process in smaller batches
- Use
wp post listwith--posts_per_pageto paginate
Permission denied
Permission denied
Error:
Error: You do not have permission to run this command.Solutions:- Run as correct user:
sudo -u www-data wp geoai audit all - Or use:
wp geoai audit all --allow-root(not recommended for production)
Related Resources
Analyzers
Learn what each analyzer checks
REST API
HTTP alternative to WP-CLI
Automation
Automate SEO audits with cron
WP-CLI Docs
Official WP-CLI documentation