diff --git a/wp-admin/revision.php b/wp-admin/revision.php
index b1590ee6d7..5cbf5cd408 100644
a
|
b
|
switch ( $action ) { |
42 | 42 | break; |
43 | 43 | } |
44 | 44 | |
45 | | $post = get_post( $revision->post_parent ); |
46 | | if ( ! $post ) { |
| 45 | $parent = get_post( $revision->post_parent ); |
| 46 | if ( ! $parent ) { |
47 | 47 | break; |
48 | 48 | } |
49 | 49 | |
50 | 50 | // Restore if revisions are enabled or this is an autosave. |
51 | | if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) { |
52 | | $redirect = 'edit.php?post_type=' . $post->post_type; |
| 51 | if ( ! wp_revisions_enabled( $parent ) && ! wp_is_post_autosave( $revision ) ) { |
| 52 | $redirect = 'edit.php?post_type=' . $parent->post_type; |
53 | 53 | break; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Don't allow revision restore when post is locked. |
57 | | if ( wp_check_post_lock( $post->ID ) ) { |
| 57 | if ( wp_check_post_lock( $parent->ID ) ) { |
58 | 58 | break; |
59 | 59 | } |
60 | 60 | |
… |
… |
switch ( $action ) { |
66 | 66 | 'message' => 5, |
67 | 67 | 'revision' => $revision->ID, |
68 | 68 | ), |
69 | | get_edit_post_link( $post->ID, 'url' ) |
| 69 | get_edit_post_link( $parent->ID, 'url' ) |
70 | 70 | ); |
71 | 71 | break; |
72 | 72 | case 'view': |
… |
… |
switch ( $action ) { |
77 | 77 | break; |
78 | 78 | } |
79 | 79 | |
80 | | $post = get_post( $revision->post_parent ); |
81 | | if ( ! $post ) { |
| 80 | $parent = get_post( $revision->post_parent ); |
| 81 | if ( ! $parent ) { |
82 | 82 | break; |
83 | 83 | } |
84 | 84 | |
… |
… |
switch ( $action ) { |
87 | 87 | } |
88 | 88 | |
89 | 89 | // Revisions disabled and we're not looking at an autosave. |
90 | | if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) { |
91 | | $redirect = 'edit.php?post_type=' . $post->post_type; |
| 90 | if ( ! wp_revisions_enabled( $parent ) && ! wp_is_post_autosave( $revision ) ) { |
| 91 | $redirect = 'edit.php?post_type=' . $parent->post_type; |
92 | 92 | break; |
93 | 93 | } |
94 | 94 | |
… |
… |
switch ( $action ) { |
104 | 104 | } |
105 | 105 | |
106 | 106 | // Empty post_type means either malformed object found, or no valid parent was found. |
107 | | if ( ! $redirect && empty( $post->post_type ) ) { |
| 107 | if ( ! $redirect && empty( $parent->post_type ) ) { |
108 | 108 | $redirect = 'edit.php'; |
109 | 109 | } |
110 | 110 | |
… |
… |
if ( ! empty( $redirect ) ) { |
114 | 114 | } |
115 | 115 | |
116 | 116 | // This is so that the correct "Edit" menu item is selected. |
117 | | if ( ! empty( $post->post_type ) && 'post' != $post->post_type ) { |
118 | | $parent_file = 'edit.php?post_type=' . $post->post_type; |
| 117 | if ( ! empty( $parent->post_type ) && 'post' != $parent->post_type ) { |
| 118 | $parent_file = 'edit.php?post_type=' . $parent->post_type; |
119 | 119 | } else { |
120 | 120 | $parent_file = 'edit.php'; |
121 | 121 | } |
122 | 122 | $submenu_file = $parent_file; |
123 | 123 | |
124 | 124 | wp_enqueue_script( 'revisions' ); |
125 | | wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $post, $revision_id, $from ) ); |
| 125 | wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $parent, $revision_id, $from ) ); |
126 | 126 | |
127 | 127 | /* Revisions Help Tab */ |
128 | 128 | |