Skip to main content
  1. All Posts/


Tools Open Source Sync WordPress
This is a bash script I wrote that copies WordPress dir and WordPress database between production, developer, local and remote environments.

It supports transferring directions as follows:

Local Prod  <--> Remote Prod
Local Prod  <--> Remote Dev
Local Prod <--> Local Dev
Local Dev <--> Remote Prod
Local Dev <--> Remote Dev
Remote Prod <--> Remote Dev

1. Update your site domain name in the script; 
2. Place the script in your ~home dir on the local server;
3. Make sure to give it executive permission 

chmod +x

4. Run the script when you need to upload an updated site 


For example, I run an exact copy of my production server on my local VirtualBox virtual machine.
My typical development cycle looks like this:

- Start VirtualBox and spin up my VM
- Log into my website https://localhost:8888/wp-admin
- Do some work on the site ...
- Upload local update to the production or dev server:

Log into my local server:
ssh admin@localhost -p2222
Start the script

Follow a prompt to choose a direction.

- Once the transfer is done, log into freshly updated site and run the search/replace for all occurrences of your domain name.

For example, for a case
localhost -->
We need to do:
Find				        	  	Replace to
//localhost:8888		  		//
//localhost:8888				//