What is a fast way to download a remote WordPress site to your local computer in order to run it in a local instance? I currently use the following way via DDEV and the free WordPress plugin BackWPup if I need to debug a site locally in a quick way.
1. Create a new project folder
.ddev/config.yaml file and change the
# DDEV project configuration # Local website will be available via <name>.ddev.site name: my-new-project type: wordpress docroot: "" nfs_mount_enabled: false mutagen_enabled: false # WebServer settings php_version: "8.1" mariadb_version: "10.5" webserver_type: nginx-fpm
The name will later be used for your local websites URL, e.g.
3. Create the file
.ddev/providers/backup.yaml, copy & paste the file content from this source:
This file does the magic of importing a backup zip file into the local instance. It is a collection of commands which import the database, copies files and replace the live sites url with the local URL in the local database. This script is possible because of the DDEV feature Hosting Provider Integration.
4. Create a backup on your remote site via BackWPup plugin
5. Download the backup file and save it as
backup.zip in your local project folder
ddev start in your local project folder
ddev pull backup to start the import
8. Open the site via
Happy (local) developing!
If you want to control the child theme folder in git and don't sync / overwrite these files on
ddev pull backup, change the
childThemeFolderName: setting in
Also add the following
.gitignore in the root level of your project directory and adjust the child theme folder name to your child theme (last line).
# Ignore all ... /* # ... but track specific files / folders: # General files !.gitignore !/README.md !/LICENSE # DDEV config and provider script !/.ddev /.ddev/* !/.ddev/config.yaml !/.ddev/providers /.ddev/providers/* !/.ddev/providers/backup.yaml # Child theme: !/wp-content /wp-content/* !/wp-content/themes /wp-content/themes/* !/wp-content/themes/twentytwentyone-child
Mixed quotes like
define("WP_SITEURL", 'https://example.com')can't be handled yet, please convert your wp-config.php to either single or double quotes
"Fatal error: Uncaught Error: Call to undefined function add_filter() in phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1296) : eval()'d code:182" - check your wp-config.php, maybe your webhosting provider added some incompatible add_filter(). Comment out these lines. Explaination: https://wordpress.org/documentation/article/configuring-automatic-background-updates/#configuration-via-filters