Marinus Klasen

Marinus Klasen

  • Development
  • Consultancy
  • Developer Resources
  • Blog
  • Contact

October 11, 2022

WordPress.com SSH & duplicating a WordPress.com website locally

Marinus Klasen

A while back, WordPress.com enabled SSH access for Business and eCommerce plans. I recently had a look at what those environments look like. First test: WP-CLI commands. It’s great to see that commands like wp db export work just fine. You’re also allowed to create folders in the home directory, so we can easily export a file and save them outside of the public root, in a folder like ~/_sql/.

Plugins, themes and WordPress Core

Most plugins and themes installed in the Dashboard are actually symlinks, linking to the root /wordpress/ folder. This is also where WordPress Core is stored. It seems like all of these files are shared files, that are used by all WordPress.com websites. That means that, for example, the Yoast SEO plugin is stored in /wordpress/plugins/wordpress-seo/latest/ which in turn links to /wordpress/plugins/wordpress-seo/19.6.1/ in which the actual files are stored.

What does that mean?

This means that creating a backup or local environment is not as straight forward as it usually is. I normally just run a command like rsync -r public_html/wp-content/ app/www/content followed by a wp db import and a wp search-replace. In this case we also have to do that for files stored in /wordpress/plugins/, /wordpress/themes/ and /wordpress/mu-plugins.

Creating a local environment for a WordPress.com website

Allright, let’s have a look at all steps involved for duplicating a WordPress.com site locally

  1. Connect via SSH (make sure to enable SSH access for the site and connect to it via Settings -> Hosting Configuration)
  2. Create a ~/_sql/ directory or something similar
  3. Run wp db export && mv *.sql ~/_sql/ in ~/htdocs
  4. Prepare a local environment for your site locally (using MAMP, docker-compose or something different)
  5. Download the sql file with something like: scp {name}@sftp.wp.com:~/_sql .
  6. Run wp db import {sql_file_name}.sql in your local site
  7. Run wp search-replace {live-domain-name} {local-domain-name} in your local site
  8. Create a new admin user with something like: wp user create admin admin@local.test --role=administrator --user_pass=password
  9. Download the wp-content files with: rsync -r {name}@sftp.wp.com:~/htdocs/wp-content/ {path_to_your}/wp-content/
  10. Download the shared plugin and theme files with:
    • rsync -r {name}@sftp.wp.com:/wordpress/plugins {path_to_your}/wp-content/plugins
    • rsync -r {name}@sftp.wp.com:/wordpress/themes {path_to_your}/wp-content/themes
  11. Visit your new local environment!

Key Take-aways

  • WP-CLI works!
  • Core, plugins and themes are stored in a root folder: /wordpress/
  • The current version of WordPress is stored in ~/htdocs/__wp__ which is a symlink to /wordpress/core/{version-number}
  • The directory structure is a bit.. unusual, a symlink called wordpress-seo in wp-content/plugins/ points to /wordpress/plugins/wordpress-seo/latest which points to /wordpress/plugins/wordpress-seo/19.6.1
  • The  /wordpress folder seems to be a a shared folder readable by all WP sites, but only after enabling or purchasing the plugin for the site

About Marinus Klasen

Marinus has been working in software/web development for more than a decade. Since 2020 his attention shifted on sharing knowledge and developing products and tools for sharing knowledge.

Marinus Klasen on Twitter

Looking for a WordPress expert?
Hire top notch developers on Codeable!

Consult an expert

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get in touch

Contact me using the details below

Marinus Klasen

Wilhelmina van Pruisenweg 35, 2595 AN Den Haag

marinus@mklasen.com
twitter.com/marinusklasen
linkedin.com/in/marinusklasen

  • GitHub
  • LinkedIn
  • Twitter

Have you read?

  • Elementor Widget UsageMarch 27, 2025
  • Programmatically showing popups with ElementorMarch 25, 2025
  • The Elementor sanitize_settings errorSeptember 12, 2024
  • Announcing.. Wooping Shop Health!June 13, 2024
  • Swiper setup when using wp-scriptsMarch 14, 2024

Copyright © 2025 ยท Marinus Klasen | Webdesign by Team Rood