WordPress SEO Optimization
Relevant source files
The following files were used as context for generating this wiki page:
The WordPress SEO Optimization system is a comprehensive suite of tools and agents designed to analyze, improve, and manage the search engine optimization of WordPress websites. It combines on-page analysis, technical SEO audits, content generation, and schema markup creation to provide a holistic approach to SEO. The functionality is distributed across several Python agents and a native WordPress plugin, allowing for both external analysis and in-platform optimizations.
The system's capabilities include calculating an SEO score, generating actionable recommendations, creating SEO-optimized content, producing various types of schema markup, and generating essential SEO files like sitemaps and robots.txt. This functionality is a core part of the DevSkyy platform's WordPress automation features.
Sources: agent/wordpress/seo_optimizer.py, agent/modules/frontend/wordpress_divi_elementor_agent.py, ENTERPRISE_README.md
Core Architecture
The SEO optimization feature is primarily driven by Python-based agents that can be called via API. A corresponding agent also exists within the WordPress plugin to perform checks directly on the site.
Python Agents
There are three main Python agents involved in SEO:
WordPressSEOOptimizer: The central agent for on-page SEO analysis, scoring, and recommendations.WordPressDiviElementorAgent: A specialized agent that performs technical and content structure SEO optimizations, particularly for sites built with Divi and Elementor.ContentGenerator: An AI-powered agent that creates SEO-optimized blog posts and page content.
WordPress Plugin Agent
A PHP-based WordPressAgent class within the Skyy Rose AI Agents plugin performs SEO checks from within the WordPress environment, such as verifying the presence of SEO plugins and sitemaps.
Sources: agent/wordpress/seo_optimizer.py, agent/modules/frontend/wordpress_divi_elementor_agent.py, agent/wordpress/content_generator.py, wordpress-plugin/includes/agents/class-wordpress-agent.php
WordPressSEOOptimizer Agent
This is the main agent responsible for comprehensive on-page SEO audits. It analyzes a given URL, scores it against best practices, and provides a set of recommendations for improvement.
Sources: agent/wordpress/seo_optimizer.py
Core Workflow
The optimize_page method orchestrates the entire analysis process. It takes a URL and target keywords, then performs a series of steps to generate a complete SEO report.
The diagram below illustrates the workflow of the optimize_page method.
The final report is a dictionary containing the SEO score, analysis data, recommendations, generated schema, and optimized meta tags.
{
"url": "https://example.com",
"seo_score": 85,
"analysis": { ... },
"recommendations": [ ... ],
"schema_markup": { ... },
"optimized_meta": {
"title": "Optimized Title",
"description": "Optimized meta description.",
"keywords": ["keyword1", "keyword2"]
},
"analyzed_at": "..."
}
Sources: agent/wordpress/seo_optimizer.py:65-74
SEO Analysis and Scoring
The agent uses a predefined set of best practices to analyze a page and calculate its SEO score. Each practice has a specific weight that contributes to the final score.
Scoring Criteria
The SEO score is calculated based on the following criteria loaded from the _load_best_practices method.
| Criteria | Rule | Weight |
|---|---|---|
| Title Length | 30-60 characters | 10 |
| Meta Description Length | 120-155 characters | 10 |
| H1 Count | Exactly 1 | 8 |
| Image Alt Text | All images have alt text | 7 |
| Internal Links | At least 2 | 6 |
| External Links | At least 1 | 4 |
| Content Length | At least 300 words | 8 |
| Keyword Density | 1.0% - 3.0% | 7 |
| HTTPS | Required | 10 |
| Mobile Friendly | Required | 10 |
Sources: agent/wordpress/seo_optimizer.py:27-46, agent/wordpress/seo_optimizer.py:280-333
Recommendations
Based on the analysis, the _generate_recommendations method produces a list of actionable items. Each recommendation includes the type, priority, issue, and suggested fix.
Example recommendation:
{
"type": "title",
"priority": "high",
"issue": "Title too short (18 chars)",
"recommendation": "Increase title length to at least 30 characters",
"impact": "High impact on SEO"
}
Sources: agent/wordpress/seo_optimizer.py:141-278
Schema Markup Generation
The agent can generate JSON-LD schema markup for various content types, which helps search engines understand the content and can lead to rich snippets in search results.
The generate_schema_markup method acts as a factory, calling the appropriate generator based on the content_type.
Supported Schema Types
| Schema Type | Generator Method |
|---|---|
article | _generate_article_schema |
product | _generate_product_schema |
organization | _generate_organization_schema |
breadcrumb | _generate_breadcrumb_schema |
Sources: agent/wordpress/seo_optimizer.py:335-351
Sitemap and Robots.txt
The agent includes utilities for generating essential SEO files.
generate_sitemap: Creates an XML sitemap from a list of pages, including URL, last modification date, change frequency, and priority.generate_robots_txt: Generates arobots.txtfile with rules for crawlers, includingAllow,Disallow, and aSitemapURL.
Sources: agent/wordpress/seo_optimizer.py:438-466, agent/wordpress/seo_optimizer.py:494-518
WordPressDiviElementorAgent SEO Features
This specialized agent focuses on technical SEO and content structure improvements, particularly for sites using Divi or Elementor page builders.
Sources: agent/modules/frontend/wordpress_divi_elementor_agent.py
Intelligent SEO Optimization Workflow
The intelligent_seo_optimization method follows a structured process to enhance a page's SEO.
This diagram shows the workflow for the intelligent_seo_optimization method.
Technical SEO Improvements
This agent performs a deeper, more technical set of optimizations compared to the core SEO optimizer.
| Optimization Area | Actions |
|---|---|
| Content Structure | Improves H1-H6 hierarchy, keyword placement, and readability. |
| Schema Markup | Implements Organization, Product, Review, Breadcrumb, and FAQ schemas. |
| Meta Tags | Optimizes title tags, meta descriptions, Open Graph, and Twitter Cards. |
| Internal Linking | Optimizes link structure, anchor text, and link distribution. Fixes broken links. |
| Technical SEO | Optimizes sitemap and robots.txt, improves page speed, and enforces HTTPS. |
Sources: agent/modules/frontend/wordpress_divi_elementor_agent.py:732-832
Content Generation for SEO
The ContentGenerator agent plays a vital role in SEO by creating new, optimized content and improving existing text.
Sources: agent/wordpress/content_generator.py
Key SEO Functions
generate_blog_post: Creates a full blog post based on a topic and keywords, including a title, meta description, and HTML-formatted content.optimize_content: Analyzes existing content for keyword density and provides suggestions to improve it. It suggests adding keywords if missing, or increasing/decreasing density to fall within the optimal 1.0-3.0% range.generate_meta_description: Automatically creates a concise meta description (max 155 characters) from a larger block of content.
Sources: agent/wordpress/content_generator.py:41-111, agent/wordpress/content_generator.py:382-421, agent/wordpress/content_generator.py:452-472
WordPress Plugin SEO Agent
The WordPressAgent class, part of the Skyy Rose AI Agents plugin, provides on-platform SEO analysis. Its optimizeSEO method runs a series of checks directly within the WordPress environment.
Sources: wordpress-plugin/includes/agents/class-wordpress-agent.php
SEO Checks
The diagram below outlines the checks performed by the optimizeSEO method.
The agent checks for the presence of popular SEO plugins like Yoast SEO, All in One SEO Pack, and Rank Math to determine if a foundational SEO tool is active on the site.
Sources: wordpress-plugin/includes/agents/class-wordpress-agent.php:292-296
Summary
The WordPress SEO Optimization system in DevSkyy is a multi-agent, multi-platform feature that provides a robust framework for improving website visibility. It combines automated analysis from the WordPressSEOOptimizer, technical enhancements from the WordPressDiviElementorAgent, content creation from the ContentGenerator, and on-site verification from the WordPressAgent plugin. This comprehensive approach addresses on-page factors, technical SEO, content quality, and essential file generation, making it a powerful tool for managing and enhancing the SEO performance of WordPress sites.