Cloning production site down to local?

I've been using WordPress for awhile now but one problem I'm constantly facing is creating a local clone of a production site so I can test changes/updates.

My current process goes something like this...

  • Run XAMPP Server
  • Download the site files (Filzilla)
  • Download the database (phpMyAdmin)
  • Create a local database (phpMyAdmin)
  • Copy site files into XAMPP
  • Import database
  • Update WP hostname, settings, etc

My question is simple. Is it possible to automate this entire process? If not, what can be automated to make this less time consuming?

I've kinda looked into Docker but it seems confusing and I don't know that it helps with most of these steps. I know there are plugins that can create backups of the site but again that only automates a couple steps. I'm pretty sure WP CLI can clone a site but I'm not sure if it can clone a remote site down to local. A solution using WP CLI would be great.

There has to be a better process than I'm doing now :(

Topic localhost testing staging Wordpress

Category Web


Yes, there are a number of ways to automate the process of moving sites between local, dev and production.

The first is a plugin by Delicious Brains called WP Migrated DB Pro. The basic free plugin will move DBs between WP installs. But the add-ons really supercharge it and allow you to move images, themes and plugins, and there's a multi-site add on as well. It's one of my most cherished tools, and it makes things SO much easier.

The second tool is Local by Flywheel. This is another method for all-in-one WP push/pull. This tool was purchased by Flywheel who were then purchased again, so it's getting a lot of attention and has recently been significantly upgraded. I haven't used the upgraded version, but the version I have used made it VERY simple to move sites between hosts.

Good luck!


It can absolutely be done using WP-Cli.

Do you have SSH access to the remote server/site? If so, I am happy to show you a process I’ve cooked up using rsync as well as just some standard SQL for the database. That’s my preferred way to do it at the moment.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.