Modernising Without Rewriting

Publication Date: 15 February 2026
Author: Michael Edwards
Executive Summary
One of the greatest temptations in software engineering is proposing a complete ground-up rewrite when faced with legacy code. However, in enterprise publishing platforms—such as national news sites or multi-brand publishing networks—a total rewrite introduces immense operational risk, content loss, and broken SEO contracts.
This post outlines proven strategies for incremental modernization, drawn from engineering work replacing legacy shortcodes with native Gutenberg blocks and writing custom WP-CLI migration tooling.
Key Principles of Incremental Refactoring
- Isolate the Legacy Layer: Wrap legacy shortcodes and dynamic database queries in clean API abstractions before attempting UI replacement.
- Build Native Block Substitutes: Replace legacy shortcodes (e.g., custom galleries, callouts, product cards) with native React-based Gutenberg blocks that match the existing editorial mental model.
- Automate Content Migration with WP-CLI: Write custom WP-CLI commands to parse post content, transform legacy shortcode markup into block comment syntax, and validate image metadata and post categories programmatically.
- Preserve Editorial Metadata & SEO: Ensure canonical URLs, structured schema data, and image alt text remain untouched throughout the automated migration pass.
Real-World Impact
By migrating legacy shortcodes to native Gutenberg blocks incrementally, editorial teams gain modern visual editing capabilities without interrupting daily publishing schedules or risking search performance penalties.
