Overview
TheSEO_Dashboard class provides comprehensive site-wide SEO analysis, tracking issues, scoring content, and generating recommendations across all published posts and pages. It includes intelligent caching for performance.
Namespace: GeoAI\Analyzers
File: includes/analyzers/class-seo-dashboard.php
Purpose
The SEO Dashboard provides:- Overall SEO Score: Site-wide health metric (0-100)
- Issue Tracking: Identifies and categorizes SEO problems
- Content Statistics: Metrics about published content
- Score Distribution: Visual breakdown by score ranges
- Top Performers: Best-optimized content
- Needs Attention: Low-scoring content requiring fixes
- Recent Activity: Latest analyzed posts
- Smart Recommendations: Actionable improvement suggestions
Public Methods
__construct()
Constructor that hooks into WordPress actions for automatic cache invalidation. Hooks:save_post- Clears cache when posts are saveddelete_post- Clears cache when posts are deleted
get_dashboard_data()
Returns comprehensive site-wide SEO health data with automatic caching. Returns:array - Dashboard data
Cache: 5 minutes (transient: geoai_dashboard_data)
Return Structure:
clear_cache()
Manually clears the dashboard cache. Called automatically on post save/delete. Returns:void
Data Structures
Overall Score
Starts at 100 and deducts points based on issue severity:- Critical: -15 points each
- High: -10 points each
- Medium: -5 points each
- Low: -2 points each
Issues Array
Each issue object:Post Statistics
Score Distribution
Recommendations
Usage Examples
Basic Dashboard Display
Issues Display
Statistics Widget
Score Distribution Chart
Top Performers List
Needs Attention Alert
Recommendations Panel
Recent Activity Feed
Manual Cache Clear
Admin Page Integration
Issue Types Reference
| Issue ID | Severity | Condition | Action |
|---|---|---|---|
posts_no_meta | high | Posts missing meta descriptions | Bulk editor |
duplicate_titles | medium | Multiple posts with same title | Bulk editor |
low_word_count | medium | Posts < 300 words | - |
no_focus_keyword | low | Posts without focus keyword | - |
readability_issues | low | Posts with score < 60 | - |
Performance & Caching
Cache Strategy
- Duration: 5 minutes (300 seconds)
- Key:
geoai_dashboard_data - Type: WordPress transient
- Invalidation: Automatic on post save/delete
Database Optimization
The dashboard uses optimized SQL queries:- Aggregation: Uses SQL
CASEstatements for distribution counts - Single Queries: Minimizes database round-trips
- Indexing: Relies on WordPress core indexes for performance
Best Practices
- Cache First: Always call
get_dashboard_data()(handles caching) - Manual Clear: Use
clear_cache()only when necessary - Large Sites: Consider increasing cache duration for 1000+ posts
- Admin Only: Restrict dashboard access to reduce server load
Meta Keys Reference
The dashboard tracks these post meta keys:_geoai_meta_description- Meta description text_geoai_focus_keyword- Focus keyword_geoai_keyword_score- Keyword optimization score (0-100)_geoai_readability_score- Readability score (0-100)