WordPress diagnostic tools for troubleshooting common issues in Trellis/Bedrock environments. These tools help identify and resolve problems with caching, performance, database operations, and WordPress core functionality.
This directory contains diagnostic scripts and tools designed to help debug WordPress issues in both development and production environments. Each tool is standalone and can be deployed independently.
Key Features:
- Production-safe diagnostic scripts
- Comprehensive reporting capabilities
- No database modifications during diagnostics
- Security-conscious design with access controls
- Compatible with Trellis/Bedrock WordPress architecture
Diagnostic tools are designed to be copied into your WordPress project as needed:
# Copy to your theme or plugin directory
cp diagnostic-transients.php /path/to/site/web/app/themes/your-theme/
# Or copy to wp-content root
cp diagnostic-transients.php /path/to/site/web/wp-content/# Upload to wp-content directory (most common)
scp transient-debug-browser.php user@server:/path/to/site/web/wp-content/
# Or use Trellis deployment
# Add file to your repository and deploy normallyWordPress transients are a way to temporarily store cached data in the database. These tools help diagnose issues when transients aren't being stored, retrieved, or expired correctly.
Purpose: Run comprehensive transient diagnostics via WP-CLI on development or production servers.
Usage:
# From Bedrock site root (development)
wp eval-file web/app/themes/your-theme/diagnostic-transients.php --path=web/wp
# Via Trellis SSH
trellis ssh production
cd /srv/www/example.com/current
wp eval-file web/app/themes/your-theme/diagnostic-transients.php --path=web/wpWhat It Tests:
- Transient Storage - Verifies set/get operations work correctly
- API Cache Status - Checks specific cache (api_properties_list) existence and expiration
- Object Cache Configuration - Detects external cache systems (Redis, Memcached, LiteSpeed)
- Database Transient Check - Verifies transients exist in wp_options table
- Transient Cleanup Cron - Lists scheduled cleanup jobs
- Business Hours Logic - Tests time-based cache lifetime calculations
- Recent Activity - Shows transients created in the last hour
Output: Terminal-formatted diagnostic report with recommendations
When to Use:
- Transients not persisting between requests
- Cache appears to be cleared unexpectedly
- API data not being cached properly
- After enabling/disabling object cache plugins
Purpose: Web-based diagnostic tool for production servers where WP-CLI access may be limited or when you need to share results with non-technical stakeholders.
Setup:
- Upload file to
wp-content/directory - Edit the file and change the
DEBUG_SECRETconstant to a unique value - Access via browser:
https://example.com/wp-content/transient-debug-browser.php?secret=your_secret
Security:
- Requires secret token in URL query parameter
- Change
DEBUG_SECRETconstant before deployment - Delete file after diagnostics are complete
- Returns HTML output (not visible in page source to casual observers)
What It Tests:
- Basic Transient Functionality - Real-time set/get/delete operations
- Database Configuration - MySQL settings that affect performance
- wp_options Table Analysis - Table size, transient count, autoload size
- Large Transient Test - Tests 1KB, 10KB, 100KB, and 1MB transients
- API Properties Cache - Checks your specific cache implementation
- Object Cache & Plugins - Detects cache plugins and configurations
- Server Environment - PHP, MySQL, WordPress versions
- Recent Transients - Last 20 transients in database
Output: Styled HTML report with color-coded results, tables, and actionable recommendations
When to Use:
- Production environment without easy WP-CLI access
- Need to share diagnostic results with clients or team members
- Want detailed database performance metrics
- Testing after server configuration changes
Both tools help identify:
- External object cache conflicts - LiteSpeed, Redis, Memcached interfering with transients
- Database storage failures - Transients not being written to wp_options table
- Expired cache issues - Transients expiring too quickly or not at all
- Plugin conflicts - Cache management plugins clearing transients unexpectedly
- Large data storage problems - MySQL packet size limits preventing large transient storage
- Autoload bloat - Too many autoloaded options slowing down WordPress
- Always change default secret tokens in browser-based tools
- Delete diagnostic files from production after use
- Never commit files with real secrets to version control
- Restrict access to diagnostic URLs (use .htaccess or Nginx rules if leaving in place)
- Run diagnostics during low-traffic periods when possible
- Browser diagnostic creates temporary test transients but cleans them up
- CLI diagnostic is lightweight and safe for production use
- Start with CLI diagnostic - Faster, more detailed for developers
- Use browser diagnostic - When you need shareable results or detailed DB analysis
- Document findings - Copy output to your issue tracker or documentation
- Test fixes - Re-run diagnostic after implementing solutions
Green (✅) - Test passed, working as expected
Yellow (
When adding new diagnostic tools to this directory:
- Follow naming convention:
diagnostic-{feature}.phpfor CLI tools,{feature}-debug-browser.phpfor web tools - Include security: Add access controls for browser-based tools
- Document thoroughly: Add inline comments explaining each test
- Update this README: Add tool description under "Available Tools"
- Test on production: Verify tool is safe and doesn't modify data
- Provide examples: Show expected output in documentation
Future diagnostic tools may include:
- Database performance diagnostics
- Image optimization verification
- Nginx configuration testing
- SSL/TLS certificate validation
- WordPress security audit tools
- Cron job monitoring
- Plugin conflict detection
- Memory usage analysis
Need Help?
These tools are designed to help identify problems, not fix them automatically. If diagnostic reports show issues:
- Review the recommendations in the tool output
- Check WordPress debug logs:
web/app/debug.log - Review server error logs:
/var/log/nginx/error.log - Consult Trellis documentation: https://roots.io/trellis/docs/
- Search WordPress support forums for specific error messages
For issues with these diagnostic tools themselves, open an issue in this repository.