Cheat Code #4: Easy search and replace in WordPress

Reading Time: < 1 minute

You’re seeing this a month later than you could have. Sign up now to get development Cheat Codes just like this delivered directly into your inbox each week.

One of the most useful WP-CLI commands I’ve come across is wp search-replace.

It makes it easy to search the database for anything and replace it. I find it great for launching a site from a temporary domain to the final domain.

wp search-replace '//temporarydomain.com' '//finaldomain.com' --dry-run

Note the --dry-run at the end there. That will run the command without making changes. Always a good idea when working with the database. When you’re ready to actually make the replacement run it again without the --dry-run.

This Weeks Tab I Won’t Close

The white space in our life is where the magic happens.”

That’s a quote from a great post on creating white space in your life from No Sidebar. I find even in my downtime I fill it with things like watching TV or listening to Audible so I’m actively working to create at least 30 minutes a day with no distractions.

Pin It on Pinterest