{"id":1273,"date":"2022-10-11T08:52:01","date_gmt":"2022-10-11T08:52:01","guid":{"rendered":"https:\/\/mklasen.com\/?p=1273"},"modified":"2022-10-11T11:32:15","modified_gmt":"2022-10-11T11:32:15","slug":"wordpress-com-ssh-duplicating-a-wordpress-com-website-locally","status":"publish","type":"post","link":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/","title":{"rendered":"WordPress.com SSH & duplicating a WordPress.com website locally"},"content":{"rendered":"\n

A while back, WordPress.com enabled SSH access for Business and eCommerce plans<\/a>. 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<\/code> 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\/<\/code>.<\/p>\n\n\n\n

Plugins, themes and WordPress Core<\/h2>\n\n\n\n

Most plugins and themes installed in the Dashboard are actually symlinks, linking to the root \/wordpress\/<\/code> 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\/<\/code> which in turn links to \/wordpress\/plugins\/wordpress-seo\/19.6.1\/<\/code> in which the actual files are stored.<\/p>\n\n\n\n

What does that mean? <\/h3>\n\n\n\n

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<\/code> followed by a wp db import<\/code> and a wp search-replace<\/code>. In this case we also have to do that for files stored in \/wordpress\/plugins\/<\/code>, \/wordpress\/themes\/<\/code> and \/wordpress\/mu-plugins<\/code>.<\/p>\n\n\n\n

Creating a local environment for a WordPress.com website<\/h2>\n\n\n\n

Allright, let’s have a look at all steps involved for duplicating a WordPress.com site locally<\/p>\n\n\n\n

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

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

          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 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[1],"tags":[],"acf":[],"yoast_head":"\nWordPress.com SSH & duplicating a WordPress.com website locally - Marinus Klasen<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/\" \/>\n<meta property=\"og:locale\" content=\"nl_NL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress.com SSH & duplicating a WordPress.com website locally - Marinus Klasen\" \/>\n<meta property=\"og:description\" content=\"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 […]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/\" \/>\n<meta property=\"og:site_name\" content=\"Marinus Klasen\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/marinus.klasen\" \/>\n<meta property=\"article:author\" content=\"http:\/\/facebook.com\/marinus.klasen\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-11T08:52:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-11T11:32:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mklasen.com\/content\/uploads\/2020\/03\/cropped-cropped-mklasen-logo-margin-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Marinus Klasen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/twitter.com\/marinusklasen\" \/>\n<meta name=\"twitter:site\" content=\"@marinusklasen\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Marinus Klasen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/\"},\"author\":{\"name\":\"Marinus Klasen\",\"@id\":\"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29\"},\"headline\":\"WordPress.com SSH & duplicating a WordPress.com website locally\",\"datePublished\":\"2022-10-11T08:52:01+00:00\",\"dateModified\":\"2022-10-11T11:32:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/\"},\"wordCount\":381,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29\"},\"articleSection\":[\"General\"],\"inLanguage\":\"nl-NL\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/\",\"url\":\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/\",\"name\":\"WordPress.com SSH & duplicating a WordPress.com website locally - Marinus Klasen\",\"isPartOf\":{\"@id\":\"https:\/\/mklasen.com\/#website\"},\"datePublished\":\"2022-10-11T08:52:01+00:00\",\"dateModified\":\"2022-10-11T11:32:15+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#breadcrumb\"},\"inLanguage\":\"nl-NL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mklasen.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"General\",\"item\":\"https:\/\/mklasen.com\/general\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"WordPress.com SSH & duplicating a WordPress.com website locally\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mklasen.com\/#website\",\"url\":\"https:\/\/mklasen.com\/\",\"name\":\"Marinus Klasen\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mklasen.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"nl-NL\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29\",\"name\":\"Marinus Klasen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"nl-NL\",\"@id\":\"https:\/\/mklasen.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/mklasen.com\/content\/uploads\/2021\/01\/DONE1171.jpg\",\"contentUrl\":\"https:\/\/mklasen.com\/content\/uploads\/2021\/01\/DONE1171.jpg\",\"width\":1500,\"height\":1000,\"caption\":\"Marinus Klasen\"},\"logo\":{\"@id\":\"https:\/\/mklasen.com\/#\/schema\/person\/image\/\"},\"description\":\"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\",\"sameAs\":[\"http:\/\/facebook.com\/marinus.klasen\",\"https:\/\/nl.linkedin.com\/in\/marinusklasen\",\"https:\/\/twitter.com\/http:\/\/twitter.com\/marinusklasen\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress.com SSH & duplicating a WordPress.com website locally - Marinus Klasen","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/","og_locale":"nl_NL","og_type":"article","og_title":"WordPress.com SSH & duplicating a WordPress.com website locally - Marinus Klasen","og_description":"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 […]","og_url":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/","og_site_name":"Marinus Klasen","article_publisher":"http:\/\/facebook.com\/marinus.klasen","article_author":"http:\/\/facebook.com\/marinus.klasen","article_published_time":"2022-10-11T08:52:01+00:00","article_modified_time":"2022-10-11T11:32:15+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/mklasen.com\/content\/uploads\/2020\/03\/cropped-cropped-mklasen-logo-margin-1.png","type":"image\/png"}],"author":"Marinus Klasen","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/twitter.com\/marinusklasen","twitter_site":"@marinusklasen","twitter_misc":{"Written by":"Marinus Klasen","Est. reading time":"3 minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#article","isPartOf":{"@id":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/"},"author":{"name":"Marinus Klasen","@id":"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29"},"headline":"WordPress.com SSH & duplicating a WordPress.com website locally","datePublished":"2022-10-11T08:52:01+00:00","dateModified":"2022-10-11T11:32:15+00:00","mainEntityOfPage":{"@id":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/"},"wordCount":381,"commentCount":0,"publisher":{"@id":"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29"},"articleSection":["General"],"inLanguage":"nl-NL","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/","url":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/","name":"WordPress.com SSH & duplicating a WordPress.com website locally - Marinus Klasen","isPartOf":{"@id":"https:\/\/mklasen.com\/#website"},"datePublished":"2022-10-11T08:52:01+00:00","dateModified":"2022-10-11T11:32:15+00:00","breadcrumb":{"@id":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#breadcrumb"},"inLanguage":"nl-NL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mklasen.com\/wordpress-com-ssh-duplicating-a-wordpress-com-website-locally\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mklasen.com\/"},{"@type":"ListItem","position":2,"name":"General","item":"https:\/\/mklasen.com\/general\/"},{"@type":"ListItem","position":3,"name":"WordPress.com SSH & duplicating a WordPress.com website locally"}]},{"@type":"WebSite","@id":"https:\/\/mklasen.com\/#website","url":"https:\/\/mklasen.com\/","name":"Marinus Klasen","description":"","publisher":{"@id":"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mklasen.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"nl-NL"},{"@type":["Person","Organization"],"@id":"https:\/\/mklasen.com\/#\/schema\/person\/bbad02776afb72dfba2ebfe1956a4e29","name":"Marinus Klasen","image":{"@type":"ImageObject","inLanguage":"nl-NL","@id":"https:\/\/mklasen.com\/#\/schema\/person\/image\/","url":"https:\/\/mklasen.com\/content\/uploads\/2021\/01\/DONE1171.jpg","contentUrl":"https:\/\/mklasen.com\/content\/uploads\/2021\/01\/DONE1171.jpg","width":1500,"height":1000,"caption":"Marinus Klasen"},"logo":{"@id":"https:\/\/mklasen.com\/#\/schema\/person\/image\/"},"description":"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","sameAs":["http:\/\/facebook.com\/marinus.klasen","https:\/\/nl.linkedin.com\/in\/marinusklasen","https:\/\/twitter.com\/http:\/\/twitter.com\/marinusklasen"]}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","featured_image_src":null,"featured_image_src_square":null,"author_info":{"display_name":"Marinus Klasen","author_link":"https:\/\/mklasen.com\/author\/mklasen\/"},"_links":{"self":[{"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/posts\/1273"}],"collection":[{"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/comments?post=1273"}],"version-history":[{"count":3,"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/posts\/1273\/revisions"}],"predecessor-version":[{"id":1276,"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/posts\/1273\/revisions\/1276"}],"wp:attachment":[{"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/media?parent=1273"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/categories?post=1273"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mklasen.com\/wp-json\/wp\/v2\/tags?post=1273"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}