Use `ddev pull` with WordPress Projects

I don't want to discuss the advantages or disadvantages of WordPress here. But sometimes even I can't avoid coming into contact with this widely used software. If that's the case, I don't want to give up the benefits of DDEV.

If I want to have a quick local copy of a remote WordPress project, I use this simple configuration for ddev pull:

A prerequisite is to have #WP-CLI on the remote system and locally inside the DDEV container.

# This will pull a WordPress database and files via SSH and RSYNC.
# It operates inside the web container and uses ssh, so you need to `ddev auth ssh` first.

environment_variables:
  REMOTE_HOST: 'user@example.org'
  REMOTE_PORT: 22
  REMOTE_BASE: '/path/on/remote/server/'
  REMOTE_WP_CLI: '/usr/bin/php84 /path/on/remote/server/wp-cli.phar'

auth_command:
  command: |
    set -eu -o pipefail
    ssh-add -l >/dev/null || ( echo "Please 'ddev auth ssh' before running this command." && exit 1 )

files_import_command:
  command: |
    # set -x   # You can enable bash debugging output by uncommenting
    set -eu -o pipefail
    ## sync all
    # rsync -e "ssh -p$REMOTE_PORT" -auv --delete $REMOTE_HOST:$REMOTE_BASE/ /var/www/html/public/
    ## sync wp-content/uploads only
    rsync -e "ssh -p$REMOTE_PORT" -auv --delete $REMOTE_HOST:$REMOTE_BASE/wp-content/uploads/ /var/www/html/public/wp-content/uploads/
  service: web

db_pull_command:
  command: |
    # set -x   # You can enable bash debugging output by uncommenting
    set -eu -o pipefail
    ssh $REMOTE_HOST -p$REMOTE_PORT "cd $REMOTE_BASE && $REMOTE_WP_CLI db export - --add-drop-table | gzip" > /var/www/html/.ddev/.downloads/db.sql.gz
  service: web

db_import_command:
  service: host
  command: |
    set -eu -o pipefail
    # set -x
    ddev import-db --file=.ddev/.downloads/db.sql.gz --no-drop
    # update URLs
    ddev exec php wp-cli.phar search-replace https://www.example.org https://example.ddev.site --path=public