Concur with @perpetualstudent about offline development.
If you start by installing on the webserver, then always copy in the direction of your PC dev you won't be overriding user data.
There are two fields in wp_options table that need to be modified each time you copy the database, these are
home that need to change to point to your local PC webserver.
For this I use the windows /etc/hosts file (on Windows 7 you need to run an editor as administrator to edit this file, and it's at
C:\Windows\System32\drivers\etc\hosts ). Create static DNS names for your site(s) like this:
127.0.0.1 website1 bikefun website3
Then edit your webserver config to create virtual hosts. I'm using WAMP, so I edit
and add sections like
then you can point your browser at
http://bikefun (e.g.). This is better than just running via
http://localhost/src/bikefun for example, apart from anything else it keeps the relative paths the same on your PC vs your production server.
To refresh your local version so it's the same as your webserver, takes two steps. The one you have to do most frequently is the database. I use SQLyog which can make a copy of the remote database onto your local PC, the first time you do this, you create an empty database on local, then switch to the server, right click on the database name and "copy to different host". Be careful when copying that you don't accidentally overwrite a production database, make sure you are copying to your local PC!
If you are using control panel you can download a dump of the database and execute that locally.
After copying, you need to change those two fields in the
When setting up your local PC version the first time, you need to copy the files from the webserver, or else duplicate the exact install locally. For example, on the webserver go to webroot and use something like
tar -czf name.tgz website-directory/
name.tgz to your local machine and extract it into your local webroot with something like 7-zip.
Subsequently I rarely repeat the copy of the files, you can keep the local copy synchronised by doing the same version updates and installing the same plugins etc. But you can repeat the file copy anytime if things get messed up on the local PC.
If you are modifying or writing plugins or themes, you need version control. I almost always create a child theme and put it into version control, but this is not necessary if you aren't modifying the theme. Once I create a new plugin, or edit an existing one, I create a GIT repository in the plugin or theme directory and clone that to github.com. Then I clone from github to the webserver (assuming you created/edited it on your local PC). That way you can develop locally and push your changes up to github (or your repository of choice) and pull them down into the webserver to upgrade the plugin/theme there.
git pull origin master
This gives you the ability to roll-back should things go wrong despite your careful testing on your local PC. So both your WordPress webroots will have one or more GIT repositories embedded in
This setup then scales if you are working with other developers on the same project and each of you has a local dev copy.
Sometimes I am working on my laptop where there is no internet connection. It's a great way to fill in a long plane flight and there are no interruptions or distractions while you work! Here's an article about how to stop timeouts from slowing everything down when you are using WordPress offline: http://www.cbdweb.net/wordpress-development-offline/