Modernizing the Monolith
Strategies for moving from spaghetti code to Bedrock/Timber.
Key Concepts
- Audit: Identifying technical debt.
- Strangler Pattern: Replacing pieces one by one.
- Data Migration: Moving content safely.
1. The Audit
Catalog all plugins, themes, and custom code. Identify what is used and what is dead.
2. Local Environment
Get the legacy site running locally using Docker/DDEV before touching anything.
3. Moving to Composer
Replace manually installed plugins with Composer dependencies one by one.
4. Database Cleanup
Remove orphaned tables and unused post meta. Optimize the database.
5. Refactoring Theme to Twig
Start by replacing the header and footer with Twig templates. Then move to page templates.
6. Replacing Shortcodes with Blocks
Write a script to parse content and convert shortcodes to block comments.
7. Media Migration
Move `wp-content/uploads` to S3. Update database references.
8. WP-CLI Search & Replace
Update URLs when moving from dev to staging to production.
wp search-replace 'http://old.com' 'https://new.com' --all-tables
9. Testing the Migration
Use visual regression testing to ensure the new site looks exactly like the old one (or better).
10. Go Live Strategy
Lower TTL. Put the site in maintenance mode. Sync the final database diff. Switch DNS.