From c2bc4dfa61ae26b390732fbe2281df7246d9ca24 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Mon, 1 Feb 2021 22:01:19 +0000 Subject: [PATCH] Revisions: Address PHP/JS errors when viewing autosave on imported posts. Fix an issue where viewing an autosave created on a post without any previous revisions would throw a PHP notice. Also fixes the revision screen which was broken in these cases and showed a console error. Props iseulde. Fixes #31249. git-svn-id: https://develop.svn.wordpress.org/trunk@50128 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/revision.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/revision.php b/src/wp-admin/includes/revision.php index 496282529c..9c4df8a943 100644 --- a/src/wp-admin/includes/revision.php +++ b/src/wp-admin/includes/revision.php @@ -281,7 +281,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null $revisions[ $post->ID ] = array( 'id' => $post->ID, 'title' => get_the_title( $post->ID ), - 'author' => $authors[ $post->post_author ], + 'author' => $authors[ $revision->post_author ], 'date' => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ), 'dateShort' => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ), /* translators: %s: Human-readable time difference. */