Get differences in post revisions
-
The following code gets me the latest post revision upon updating a post:
function insert_post_hook($post_id, $post) { var_dump(array_shift(wp_get_post_revisions($post_id))); exit; }
add_action( ‘wp_insert_post’, ‘insert_post_hook’, 10, 2 );
However, this only gives me som basic data like title, time, revision id etc. What I would really like, is to get the differences that has been made in this revision compared to the last one before that – like what is shown in the revisions tab of the editor.How would I get these specific changes?
I tried the following approach, but that just gives me a server error. 4967 is the post id, and 4971 & 4972 are revisions of the post.
var_dump(wp_get_revision_ui_diff(4967, 4971, 4972));
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Get differences in post revisions’ is closed to new replies.