Editing WordPress theme on localhost is very easy and fast, but it’s getting tricky if you want to move your site’s database from the local environment to live server.
Here is 4 step you need to follow:
- Move all file to live server.
- Move local database to live mySQL
- Change database details in wp-congig.php file
- Run the script bellow to change all localhost text with new site url.
UPDATE wp_options SET option_value = replace(option_value, 'localhost', 'www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'localhost','www.newsite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'localhost', 'www.newsite.com');
Alternatively, you can use the tools like “Search and Replace for WordPress” to do more advanced things such as perform dry-run and replace serialised data.
Download the latest version: