get post meta before it is updated (during SAVE_POST)

save_post Runs whenever a post or page is created or updated, which
could be from an import, post/page edit form, xmlrpc, or post by
email. Action function arguments: post ID and post object. Runs after
the data is saved to the database.

above paragraph is quoted from WP Codex.

so you cannot use this hook to get older value because it fires after saving new values to DB. WP has another action hook named wp_insert_postbut sadly this hook does same thing as save_post

alternatively you can use Filters to get the job done. WP provides few filter to edit the post while saving or before saving to DB. like wp_insert_post_data & content_save_pre might work for you, i think.

Update

here is another discussionon this topic which might be helpful for you.

Leave a Comment