Skip to content

Instantly share code, notes, and snippets.

@beardedtim
Last active February 23, 2024 02:45
Show Gist options
  • Save beardedtim/b7b316f9e4696fd9415c to your computer and use it in GitHub Desktop.
Save beardedtim/b7b316f9e4696fd9415c to your computer and use it in GitHub Desktop.
How to clone wordpress to local dev

In Terminal

  • cd into your Dev folder
  • git clone scotchbox folderName
  • change ** in vagrantfile line config.vm.network "private_network", ip: "192.168.33.**" to a new two digit number
  • open up hosts file (Finder -> Go -> Go To Folder - > /private/etc/hosts )
  • if you don't have access to edit that, create new plaintext doc
  • add new line with 192.168.33.** urlName.dev with ** being the two digit number you entered
  • if you used a new plaintext doc, override/replace /private/etc/hosts with new file
  • cd into Dev/folderName/public
  • using wp CLI, type wp core download

In CPanel of Hosted WP Site

  • Go to File Manager
  • under public_html, compress wp_content
  • download wp_content.zip

In Dashboard of Hosted WP Site

make sure you have WP Syncd DB

  • Click Plugins on side panel
  • under WP Sync DB, click Settings
  • at new page, click Settings tab
  • click Accept pull requests allow this database to be exported and downloaded
  • copy all of the things inside of Connection Info box

In Terminal (again)

  • cd into Dev/folderName
  • enter command vagrant up
  • It will fail and restart and that is okay

In Sequal Pro

  • in opening menu, under SSH Host, change the last two to the two numbers you entered
  • if you haven't set up a favorite yet and are doing it for the first time, google it
  • create new db that I always call after the urlName

In Browser

  • go to urlName.dev
  • follow Wordpress install instructions
  • I have root/root as my MySql stuff and the database is the one we just created
  • leave localhost and wp_
  • everything that you type in the next screen will be overridden when you sync the db so it doesn't matter
  • HOWEVER!!! You will need to login once, so know your username and password!
  • If you fuck up or something happens, just enter Sequal pro, drop your tables, and revist urlName.dev

In New WordPress Dashboard

  • go to plugins
  • install WP Sync DB
  • go to WP Sync DB settings
  • under the Migrate tab, choose Pull
  • enter the already hosted WP's stuff you copied before (if you don't have it, just go back and get it)
  • click Migrate DB

In Local folders

  • navigate to Dev/folderName/public
  • erase wp_content
  • unzip the wp_content that you downloaded from the already hosted WP
  • You will be signed out and have to sign back in WITH YOUR HOSTED WP CREDS!

That should be all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment