Skip to main content
Glama

audit_wordpress_theme

Analyze WordPress themes for security vulnerabilities, performance issues, accessibility compliance, SEO optimization, and code quality to identify technical debt and ensure compatibility.

Instructions

Comprehensive WordPress theme audit - chains multiple analysis steps for security, performance, accessibility, SEO, and code quality

WORKFLOW: Perfect for understanding complex code, identifying issues, and technical debt assessment TIP: Use Desktop Commander to read files, then pass content here for analysis SAVES: Claude context for strategic decisions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
auditDepthNoDepth of audit analysiscomprehensive
auditTypeNoType of audit focusfull-audit
checkAccessibilityNoInclude detailed accessibility audit
includeStepsNoAnalysis steps to include in theme audit
maxDepthNoMaximum directory depth for analysis (1-5)
phpVersionNoTarget PHP version for compatibility checks8.0
projectPathYesPath to WordPress theme root directory
themeTypeNoType of WordPress themeclassic
wpVersionNoTarget WordPress version for compatibility checks6.4

Implementation Reference

  • Plugin class declaration registering the tool with name 'audit_wordpress_theme'
    export class WordPressThemeAuditor extends BasePlugin implements IPromptPlugin {
      name = 'audit_wordpress_theme';
      category = 'analyze' as const;
      description = 'Comprehensive WordPress theme audit - chains multiple analysis steps for security, performance, accessibility, SEO, and code quality';
  • Input parameter schema definition for the audit_wordpress_theme tool
    parameters = {
      // Multi-file parameters (primary mode for theme audit)
      projectPath: {
        type: 'string' as const,
        description: 'Path to WordPress theme root directory',
        required: true
      },
      
      // Analysis configuration
      auditDepth: {
        type: 'string' as const,
        description: 'Depth of audit analysis',
        enum: ['basic', 'detailed', 'comprehensive'],
        default: 'comprehensive',
        required: false
      },
      auditType: {
        type: 'string' as const,
        description: 'Type of audit focus',
        enum: ['security', 'performance', 'accessibility', 'seo', 'quality', 'full-audit'],
        default: 'full-audit',
        required: false
      },
      
      // Theme-specific analysis steps
      includeSteps: {
        type: 'array' as const,
        description: 'Analysis steps to include in theme audit',
        required: false,
        items: { type: 'string' as const },
        default: ['structure', 'security', 'performance', 'accessibility', 'quality', 'seo']
      },
      
      maxDepth: {
        type: 'number' as const,
        description: 'Maximum directory depth for analysis (1-5)',
        required: false,
        default: 4
      },
      
      // WordPress-specific context
      wpVersion: {
        type: 'string' as const,
        description: 'Target WordPress version for compatibility checks',
        required: false,
        default: '6.4'
      },
      phpVersion: {
        type: 'string' as const,
        description: 'Target PHP version for compatibility checks', 
        required: false,
        default: '8.0'
      },
      
      // Theme-specific options
      themeType: {
        type: 'string' as const,
        description: 'Type of WordPress theme',
        enum: ['classic', 'block', 'hybrid'],
        default: 'classic',
        required: false
      },
      checkAccessibility: {
        type: 'boolean' as const,
        description: 'Include detailed accessibility audit',
        default: true,
        required: false
      }
    };
  • Main handler function that orchestrates the WordPress theme audit execution
    async execute(params: any, llmClient: any) {
      return await withSecurity(this, params, llmClient, async (secureParams) => {
        try {
          // 1. Validate WordPress theme structure
          this.validateWordPressTheme(secureParams);
          
          // 2. Setup model
          const { model, contextLength } = await ModelSetup.getReadyModel(llmClient);
          
          // 3. Execute chained theme analysis workflow
          return await this.executeChainedThemeAnalysis(secureParams, llmClient, model, contextLength);
          
        } catch (error: any) {
          return ErrorHandler.createExecutionError('audit_wordpress_theme', error);
        }
      });
    }
  • Core chained analysis handler implementing the multi-step WordPress theme audit workflow
    private async executeChainedThemeAnalysis(params: any, llmClient: any, model: any, contextLength: number) {
      const auditSteps = params.includeSteps || ['structure', 'security', 'performance', 'accessibility', 'quality', 'seo'];
      const results: Record<string, any> = {};
      const stepExecutionLog: string[] = [];
      
      try {
        stepExecutionLog.push(`Starting WordPress theme audit with ${auditSteps.length} steps`);
        stepExecutionLog.push(`Theme type: ${params.themeType || 'classic'}`);
        
        // Step 1: Theme Structure Overview
        if (auditSteps.includes('structure')) {
          stepExecutionLog.push('Executing: Theme structure analysis');
          results.structure = await this.runAnalysisStep('count_files', {
            projectPath: params.projectPath,
            analysisType: 'comprehensive',
            maxDepth: params.maxDepth
          }, llmClient);
          stepExecutionLog.push(`Structure analysis: ${results.structure.success ? 'SUCCESS' : 'FAILED'}`);
        }
        
        // Step 2: WordPress Theme Security Audit
        if (auditSteps.includes('security')) {
          stepExecutionLog.push('Executing: WordPress theme security analysis');
          results.security = await this.runAnalysisStep('analyze_wordpress_security', {
            projectPath: params.projectPath,
            wpType: 'theme',
            wpVersion: params.wpVersion,
            analysisType: 'comprehensive',
            includeOwaspTop10: true
          }, llmClient);
          stepExecutionLog.push(`Security analysis: ${results.security.success ? 'SUCCESS' : 'FAILED'}`);
        }
        
        // Step 3: Performance Analysis (theme-specific)
        if (auditSteps.includes('performance')) {
          stepExecutionLog.push('Executing: Theme performance analysis');
          results.performance = await this.runAnalysisStep('analyze_code_quality', {
            projectPath: params.projectPath,
            analysisType: 'performance',
            language: 'php',
            context: { 
              projectType: 'wordpress-theme',
              themeType: params.themeType,
              focusAreas: ['performance', 'optimization']
            }
          }, llmClient);
          stepExecutionLog.push(`Performance analysis: ${results.performance.success ? 'SUCCESS' : 'FAILED'}`);
        }
        
        // Step 4: Accessibility Audit
        if (auditSteps.includes('accessibility') && params.checkAccessibility) {
          stepExecutionLog.push('Executing: Accessibility analysis');
          results.accessibility = await this.runAnalysisStep('analyze_single_file', {
            projectPath: params.projectPath,
            analysisType: 'comprehensive',
            context: {
              projectType: 'wordpress-theme',
              focusAreas: ['accessibility', 'wcag', 'semantic-html'],
              standards: ['WCAG 2.1 AA', 'Section 508']
            }
          }, llmClient);
          stepExecutionLog.push(`Accessibility analysis: ${results.accessibility.success ? 'SUCCESS' : 'FAILED'}`);
        }
        
        // Step 5: Code Quality Assessment
        if (auditSteps.includes('quality')) {
          stepExecutionLog.push('Executing: Code quality analysis');
          results.quality = await this.runAnalysisStep('analyze_code_quality', {
            projectPath: params.projectPath,
            analysisType: 'comprehensive',
            language: 'php',
            context: { projectType: 'wordpress-theme' }
          }, llmClient);
          stepExecutionLog.push(`Quality analysis: ${results.quality.success ? 'SUCCESS' : 'FAILED'}`);
        }
        
        // Step 6: SEO Analysis
        if (auditSteps.includes('seo')) {
          stepExecutionLog.push('Executing: SEO structure analysis');
          results.seo = await this.runAnalysisStep('analyze_single_file', {
            projectPath: params.projectPath,
            analysisType: 'comprehensive',
            context: {
              projectType: 'wordpress-theme',
              focusAreas: ['seo', 'structured-data', 'meta-tags', 'performance']
            }
          }, llmClient);
          stepExecutionLog.push(`SEO analysis: ${results.seo.success ? 'SUCCESS' : 'FAILED'}`);
        }
        
        // Step 7: Database Query Analysis (if applicable)
        if (auditSteps.includes('database')) {
          stepExecutionLog.push('Executing: Database query analysis');
          results.database = await this.runAnalysisStep('analyze_database_queries', {
            projectPath: params.projectPath,
            analysisType: 'comprehensive',
            context: { projectType: 'wordpress-theme' }
          }, llmClient);
          stepExecutionLog.push(`Database analysis: ${results.database.success ? 'SUCCESS' : 'FAILED'}`);
        }
        
        // Step 8: Synthesize all results
        stepExecutionLog.push('Synthesizing comprehensive theme audit report');
        const synthesizedResults = await this.synthesizeThemeAuditResults({
          ...results,
          executionLog: stepExecutionLog,
          completedSteps: auditSteps.filter(step => results[step]?.success),
          failedSteps: auditSteps.filter(step => results[step]?.success === false)
        }, params, model, contextLength);
        
        stepExecutionLog.push('Theme audit synthesis: COMPLETED');
        return synthesizedResults;
        
      } catch (error: any) {
        stepExecutionLog.push(`Theme audit failed: ${error.message}`);
        return ErrorHandler.createExecutionError('audit_wordpress_theme', error);
      }
    }
  • Helper method for synthesizing all audit results into the final comprehensive report
    private async synthesizeThemeAuditResults(results: Record<string, any>, params: any, model: any, contextLength: number) {
      // Generate final synthesis prompt stages
      const promptStages = this.getMultiFilePromptStages({
        ...params,
        analysisResult: results,
        stepCount: Object.keys(results).length
      });
      
      // Always use chunking for comprehensive synthesis
      const promptManager = new ThreeStagePromptManager();
      const chunkSize = TokenCalculator.calculateOptimalChunkSize(promptStages, contextLength);
      const dataChunks = promptManager.chunkDataPayload(promptStages.dataPayload, chunkSize);
      const conversation = promptManager.createChunkedConversation(promptStages, dataChunks);
      const messages = [
        conversation.systemMessage,
        ...conversation.dataMessages,
        conversation.analysisMessage
      ];
      
      return await ResponseProcessor.executeChunked(
        messages,
        model,
        contextLength,
        'audit_wordpress_theme',
        'multifile'
      );
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/houtini-ai/lm'

If you have feedback or need assistance with the MCP directory API, please join our Discord server