From c8f167629d731fd427332a266f8932bc95a51048 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Fri, 25 Sep 2015 14:03:30 +0000 Subject: [PATCH] Revisions: add a `'wp_prepare_revision_for_js'` filter. Props jtsternberg, adamsilverstein. Fixes #28627. git-svn-id: https://develop.svn.wordpress.org/trunk@34541 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/revision.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/revision.php b/src/wp-admin/includes/revision.php index 67bb56c761..756a1dd500 100644 --- a/src/wp-admin/includes/revision.php +++ b/src/wp-admin/includes/revision.php @@ -199,7 +199,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null $current_id = $revision->ID; } - $revisions[ $revision->ID ] = array( + $revisions_data = array( 'id' => $revision->ID, 'title' => get_the_title( $post->ID ), 'author' => $authors[ $revision->post_author ], @@ -210,6 +210,16 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null 'current' => $current, 'restoreUrl' => $can_restore ? $restore_link : false, ); + + /** + * Filter the array of revisions used on the revisions screen. + * + * @since 4.4.0 + * + * @param array $revisions_data The bootstrapped data for the revisions screen. + * @param WP_Post $post The revision's parent WP_Post object. + */ + $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $post ); } /**