0

A custom field on posts in my Wordpress installation stores an image URL. I need to know when this custom field was updated, and by which user, for a particular post.

I know this data is not stored in the built-in Revisions feature, but is there some way to tell from the database?

1 Answer 1

0

By default, no. When WP Core saves postmeta (i.e. custom fields) in the database, it associates it to the parent post - not the current revision, and the database does not store a timestamp for when postmeta was stored.

If you want to keep track of future postmeta changes, you can add code to version it. This will associate the postmeta to the corresponding revision ID, instead of the parent post ID. Then, if you come across a page with postmeta you want to track down, you can check in the database, revision by revision: search for the postmeta where the meta_key corresponds to that piece of data (this will be the name of your custom field) and where the post_id equals the ID of the revision you're checking. Once you find the oldest revision ID where that postmeta was set, you can then check in the revision history to see who the author was of that revision, which is the person who changed the postmeta to that value.

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.