WordPress WP-CLI 2 · Database

Change a URL everywhere

Replace a URL across the database. It handles serialized data safely, unlike a plain SQL replace.

wp search-replace 'http://old.example' 'https://new.example' --skip-columns=guid

Caution: Export a backup first, and run the --dry-run version to check the count.

Official WordPress WP-CLI 2 documentation

More database commands

All database commands · WordPress WP-CLI 2 cheatsheet

Was this page helpful?