# Cleaning up legacy shortcodes: migrating from page builders to block patterns

> A step-by-step agency guide to identifying legacy page builder shortcodes, cleaning wp_posts content, and replacing brittle layouts with core block patterns.

Published 23 August 2026 by Jake at Pattern Paste.
Canonical: https://patternpaste.com/blog/migrating-from-page-builders-to-block-patterns/
Tags: WordPress, Page builders, Tutorial

---

When an agency inherits a legacy WordPress website built on WPBakery, Divi, or early versions of Elementor, the database is typically crowded with proprietary shortcodes. Deactivating the old builder leaves raw tags like `[vc_row]`, `[vc_column]`, and `[et_pb_section]` exposed directly on published pages.

Rebuilding every page manually from scratch is rarely viable on tight client budgets. A systematic migration workflow allows you to audit existing shortcodes, clean the database records, and replace complex builder layouts with modern core block patterns.

## Auditing the database for legacy shortcode footprints

Before touching code or deactivating plugins, query `wp_posts` to assess which shortcodes are present and how many records are affected.

Using WP-CLI on your staging environment:

```bash
# Search for WPBakery shortcodes in published pages
wp db query "SELECT ID, post_title FROM wp_posts WHERE post_content LIKE '%[vc_%' AND post_status = 'publish' AND post_type = 'page';"

# Search for Divi builder shortcodes
wp db query "SELECT ID, post_title FROM wp_posts WHERE post_content LIKE '%[et_pb_%' AND post_status = 'publish' AND post_type = 'page';"
```

This query produces a clean list of URLs that require layout conversion.

## Stripping orphaned shortcodes safely

If you deactivate a page builder without removing its shortcodes, WordPress ignores unregistered tags and prints them as plain text on the front end.

You can strip orphaned wrapper tags temporarily by registering a fallback filter in your theme's `functions.php` or a temporary mu-plugin during staging:

```php
/**
 * Safely suppress orphaned shortcodes on the front end during migration.
 */
add_action( 'init', function () {
    $orphaned_shortcodes = array( 'vc_row', 'vc_column', 'vc_column_text', 'et_pb_section', 'et_pb_row' );
    foreach ( $orphaned_shortcodes as $tag ) {
        if ( ! shortcode_exists( $tag ) ) {
            add_shortcode( $tag, function ( $atts, $content = '' ) {
                return do_shortcode( $content );
            } );
        }
    }
} );
```

This helper executes any nested content while stripping away the enclosing structural shortcode markup, allowing the underlying text and images to render cleanly.

## Replacing builder widgets with core block patterns

Legacy builders usually group content into predictable layout archetypes: heroes, three-column feature cards, client quote strips, and call-to-action footers.

Instead of writing custom block code for each layout, map legacy widgets directly to standard core block patterns:

| Legacy builder component | Native core block equivalent |
|---|---|
| Full-width banner / Hero slider | `wp:cover` with nested `wp:heading` and `wp:buttons` |
| 3-column feature grid (`[vc_row]`) | `wp:columns` with 3 `wp:column` groups |
| Testimonial box (`[et_pb_testimonial]`) | `wp:quote` or styled `wp:group` with avatar `wp:image` |
| Pricing table widget | `wp:columns` with nested semantic lists and buttons |

Open the target page in the block editor, paste the pre-built core block pattern onto the canvas, copy the text from the legacy section into the new blocks, and delete the legacy shortcode container.

## Verifying database records and cleanup

Once key templates and pages are converted:

1. **Check for raw shortcode remnants:** Run your WP-CLI query again to confirm that zero published pages contain legacy shortcode tags.
2. **Remove temporary shortcode suppression filters:** Delete the migration mu-plugin once all pages store pure block markup.
3. **Deactivate and delete the builder plugin:** Verify that the front end renders cleanly with zero console errors or missing asset requests.
4. **Purge persistent transients and cache:** Flush object cache and page caching layers (`wp cache flush`) to ensure stale markup is removed from CDN caches.

*Pattern Paste makes migrating away from page builders straightforward by providing 232 ready-to-paste core block patterns for heroes, feature grids, pricing tables, and footers. [Browse the pattern catalogue](/patterns/), or read [our comparison of block themes vs page builders](/blog/block-themes-vs-page-builders/).*
