WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have built several Wordpress websites and noticed that custom fields are not restored to previous revisions. This might cause a problem when using custom fields to store content. Anybody knows how to add the custom fields to the revision history?

share|improve this question
Two things: 1) This plugin: github.com/adamsilverstein/wp-post-meta-revisions 2) This plugin: pastebin.com/LMwEush4 The first one enables custom meta fields to be saved at revision time. The second one gives you a nice admin screen to select which custom meta fields will trigger a revision. – Bob Chip Jul 12 '15 at 21:17

Post revisions are for the fields in the posts database table and not the postmeta database table.

So if you want to create your own postmeta revision you could save the meta when the revision is made using _wp_put_post_revision and you can restore the meta using wp_restore_post_revision.

share|improve this answer
Doesn't _wp_put_post_revision save only post data (title, content)? It uses _wp_post_revision_fields which doesn't check for custom fields? My goal is to be able to restore the custom fields to any point in the history of the post, as in the revisions of the title and content. – Tomer Lavi Jun 29 '11 at 14:53
@Tomer, that is exactly what i'm saying _wp_put_post_revision saves only post fields and not post meta (custom fields), so to save your custom fields before a post revision is created you can hook to the _wp_put_post_revision hook and save your the custom fields you want, and when you restore a revision you can use wp_restore_post_revision to restore those saved fields as well – Bainternet Jun 29 '11 at 18:19
I see now, thanks. – Tomer Lavi Jun 29 '11 at 18:37

Your Answer


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.