Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have development and production versions of my website (on the same hosting). I want to easily synchronize the content between these versions. On the production website, content is updated daily.

I cannot use the XML export function because duplicate posts would be created on the development website.

Currently both websites uses different databases, but if there is a solution that allows for usage of only one database I gladly will go through it.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

If you never send/sync Production posts to live.

Then just pull/copy the live database to the development database via mysqldump (or similar) and use wp-config vars to force the site and blog URL.

Use the following in the dev versions wp-config.php to force the URL's

define('WP_HOME','http://example.com');
define('WP_SITEURL', 'http://example.com');

You may as well sync the entire database, rather than just posts, so then you get all the post revisions as well as any plugin configurations/data.

This is my normal method of developing a live site, locally. (Grab live DB drop Dev DB import Live DB into Dev) (The only fun bit is sending specific plugin configs up to the live site from the dev site)

share|improve this answer
1  
Thanks! I found a very useful plugin called SitePush which do all this job for me, plugin use mysqldump for database management, but also have options for sync theme or plugin files. Here is the plugin page: wordpress.org/extend/plugins/sitepush/installation –  Kristian Vitozev Nov 21 '12 at 23:08
    
To be honest and this is my opinion. If you are using a plugin to do this, you are not developing your site properly. As your development site won't be a true model of the live site. You should look at using version control for file management. –  Barry Carlyon Nov 22 '12 at 15:36
    
Let alone the likely hood that using a plugin relies on PHP/Apache's memory limit to export the database from a command line application –  Barry Carlyon Nov 22 '12 at 15:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.