I would like to version control my WP sites with git. A big struggle I have with this is: how do you version control options/plugin settings in the database.

I would like to don't touch the dashboard in the live site. Only the users should need to login in to write posts - but I as a developer would like to log in only to check if everything is working on the live machine. Is there a way to do this?

I know that Drupal 8 has a build in configuration management - that's their solution. I also know "versionpress" and similar plugins. But they also version control the posts/pages/users etc. I don't need this. Example:

Update option 'site_url' to 'http://example.com';
Reset update option 'site_url' to 'http://noexample.com';```

(the second line is to redo this step)

I guess there are some things in ruby on rails or similar. Would be great to separate code/options/settings and content/media/user-generated-stuff.

  • You asked for version control, but you want something to add options and pages? I am confused. Do you want something like WP-CLI?
    – gdaniel
    Commented Apr 1, 2016 at 14:10
  • I have to check what WP-CLI could do for me on this. I want to version control code and configuration. In the options table there are lots of configuration (and too much junk that should be somewhere else - like transients). There should be a way to also deliver that via code. And there are sometimes a) pages that are there as part of a plugin - like woocommerce checkout pages b) plugin configuration that is not done in a centralised positon. Would be great to have this all in code. Oh yes - this is part of the solution: wp-cli.org/commands/option Commented Apr 1, 2016 at 20:40
  • plugin and library recommendations are off-topic here Commented Apr 3, 2016 at 14:09
  • @MarkKaplun - I would have been helpful to give me a hint where I can find what is on-topic. I consider my question a question about the workflow to develop my own theme and plugins. This still might be off-topic. Commented Apr 3, 2016 at 21:22
  • Hi Sebastian, you have been prompted the tour when you signed up. There you should have seen a big blue button saying "help center". A link there is in the top menu (filed under "help") as well. Aside from that, you might want to file an edit explaining that you want to version control your database, or provide a very specific non-vanilla, pre-configured database. A starting point might be this meta post. Try something, fail somewhere, edit again with progress and where you stuck. Hope that helps.
    – kaiser
    Commented Apr 4, 2016 at 19:22

4 Answers 4


WP-CFM is probably the closest to what you're looking for. Actually, it has been inspired by Drupal's Features module.

From the plugin page:

WP-CFM lets you copy database configuration to / from the filesystem. Easily deploy configuration changes without needing to copy the entire database.

However, as someone who has spent the better part of the past few years working on the versioning solution for WordPress (I'm a co-creator of VersionPress), I can say that it's tricky to version-control only parts of the site. For example, a plugin might store some of its configuration in wp_options, some of it on the disk (in some PHP file, for instance) and some of it in postmeta or whatever. Full version control is hard (which is why VersionPress takes its time) but it's the only 100% reliable way.

If you're sure you good with just wp_options (and some other tracked entities that WP-CFM provides; see the linked plugin page) then I agree that it's better to use the simpler tool.

  • @kaiser Sorry for the previous "link-only" answer, I've expanded it in this new answer. Commented Apr 3, 2016 at 12:56
  • Not a problem. Still, I am really not happy with how this question turned out: A big link-dump.
    – kaiser
    Commented Apr 4, 2016 at 19:25

Not sure of what u need but....

  1. Maybe your can track the activities by using a Activity log... https://wordpress.org/plugins/aryo-activity-log/

  2. Most of these activities for "insert options/pages/settings via code" happen in the database.. you can use a cron to take a snapshot of the database and the compare the difference...


Failed plugin update? Mistakenly deleted post? Just undo it. Also, painless staging for WordPress (finally!), great backup & team workflows, all powered by Git.

Working on this next-gen thing for you, you can get Early Access and support us: http://versionpress.net/

This seems to be something you could use for Version Control, BUT it seems like it's "early access program": http://docs.versionpress.net/en/getting-started/about-eap

Other plugins:


https://www.presslabs.com/gitium/ - beta

  • 1
    I have to give revisr and gitium a second look. As far as I know VersionPress commits everything - every little database change etc. That seems to be way too much for what I would like for this project. But all in all it is a great approach and I am already an Early Access Backer Commented Apr 1, 2016 at 20:32
  • Let me know what you end up using. :D Commented Apr 1, 2016 at 20:44

WordPress aside, if you're looking for a way to see what has changed in a MySQL database in a specific time frame, then binary logs are your most reliable bet. These beasts will record every statement which alters your database in any way, allowing you to replay them (or a subset of them) on another database.

They're perfect for audits, replication and point-in-time recovery. Not so good for "merging changes" to another database which may also have been altered, mostly because of AUTO_INCREMENT columns which will almost always cause conflicts. It's probably possible with a lot of manual work, but I wouldn't go there in a million years.

With regards to WordPress, a neat trick is to keep your options under version control with... version control:

add_filter( 'pre_option_posts_per_page', function( $per_page ) {
    return 50;

This way, regardless of your database, the posts_per_page option will always be 50. You can read more about the pre_option_* filter here.

And as many folks have already mentioned, there are plugins and tools specific to WordPress that attempt to provide some type of version control for WordPress content and settings. Another one worth mentioning is the pricey RAMP plugin by Crowd Favorite.

As Borek mentioned, it's very tricky to build reliability into such a tool, because of all the different and crazy things third-party plugins can do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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