This is my preferred procedure for bringing a remote site to my Local server for development.
Requirements
- Local - https://localwp.com/
- File system access for both source and destination websites.
- phpMyAdmin access on source website.
Backup Procedure
- Access the file system of the source website and download a copy of the site's wp-content folder. You can do this via FTP or via the hosting account's file manager application.
- Export the source website's database to a .sql file using phpMyAdmin. The quick export default conditions work for this.
- You should be prompted to download the .sql file.
Restore to new location
- Create a fresh WordPress site in Local.
- Access the file system and replace the wp-content folder with the one downloaded from the source site.
- Reset the destination site's database by removing all the tables.
- Open the database in Adminer.
- Select all the tables.
- Click Drop.
- Note: the wp cli command 'wp db reset' does not work at the time of this writing in Local.
- Restore import the source database to the destination database using wp-cli.
- Copy the source website's database backup file to the root of you Local WordPress installation.
- In Local select the destination site, right click, and select "Open Site Shell". A command line window should open.
- At the command line import the database using the wp-cli command: "wp db import <database backup sql filename>".
- Upon success you may delete the source website .sql backup file from site's file system.
- Use wp-cli search and replace to replace the source site url with the destination site url in the database.
- At the command line type: "wp search-replace 'https://source-site-url' 'https://destination-site-url".