| 1 | Index: wp-admin/includes/template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/includes/template.php (revision 17436) |
|---|
| 4 | +++ wp-admin/includes/template.php (working copy) |
|---|
| 5 | @@ -2042,7 +2042,7 @@ |
|---|
| 6 | * @param string $id Screen id, optional. |
|---|
| 7 | */ |
|---|
| 8 | function set_current_screen( $id = '' ) { |
|---|
| 9 | - global $current_screen, $hook_suffix, $typenow, $taxnow; |
|---|
| 10 | + global $current_screen, $hook_suffix, $typenow, $taxnow, $post_id; |
|---|
| 11 | |
|---|
| 12 | $action = ''; |
|---|
| 13 | |
|---|
| 14 | @@ -2083,13 +2083,23 @@ |
|---|
| 15 | $current_screen->id .= '-' . $typenow; |
|---|
| 16 | $current_screen->post_type = $typenow; |
|---|
| 17 | } elseif ( 'post' == $current_screen->id ) { |
|---|
| 18 | + $post_id = isset($_GET['post']) ? (int) $_GET['post'] : 0; |
|---|
| 19 | + $post_id = isset($_POST['post_ID']) ? (int) $_POST['post_ID'] : $post_id; |
|---|
| 20 | + |
|---|
| 21 | + if ( $post_id ) { |
|---|
| 22 | + $post = get_post( $post_id ); |
|---|
| 23 | + $typenow = $post->post_type; |
|---|
| 24 | + } |
|---|
| 25 | + |
|---|
| 26 | if ( empty($typenow) ) |
|---|
| 27 | $typenow = 'post'; |
|---|
| 28 | - $current_screen->id = $typenow; |
|---|
| 29 | - $current_screen->post_type = $typenow; |
|---|
| 30 | + |
|---|
| 31 | + $current_screen->id = $current_screen->post_type = $typenow; |
|---|
| 32 | } elseif ( 'edit-tags' == $current_screen->id ) { |
|---|
| 33 | if ( empty($taxnow) ) |
|---|
| 34 | $taxnow = 'post_tag'; |
|---|
| 35 | + if ( empty($typenow) ) |
|---|
| 36 | + $typenow = 'post'; |
|---|
| 37 | $current_screen->id = 'edit-' . $taxnow; |
|---|
| 38 | $current_screen->taxonomy = $taxnow; |
|---|
| 39 | } |
|---|
| 40 | Index: wp-admin/post.php |
|---|
| 41 | =================================================================== |
|---|
| 42 | --- wp-admin/post.php (revision 17436) |
|---|
| 43 | +++ wp-admin/post.php (working copy) |
|---|
| 44 | @@ -16,34 +16,9 @@ |
|---|
| 45 | |
|---|
| 46 | wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder')); |
|---|
| 47 | |
|---|
| 48 | -if ( isset($_GET['post']) ) |
|---|
| 49 | - $post_id = (int) $_GET['post']; |
|---|
| 50 | -elseif ( isset($_POST['post_ID']) ) |
|---|
| 51 | - $post_id = (int) $_POST['post_ID']; |
|---|
| 52 | -else |
|---|
| 53 | - $post_id = 0; |
|---|
| 54 | -$post_ID = $post_id; |
|---|
| 55 | -$post = null; |
|---|
| 56 | -$post_type_object = null; |
|---|
| 57 | -$post_type = null; |
|---|
| 58 | -if ( $post_id ) { |
|---|
| 59 | - $post = get_post($post_id); |
|---|
| 60 | - if ( $post ) { |
|---|
| 61 | - $post_type_object = get_post_type_object($post->post_type); |
|---|
| 62 | - if ( $post_type_object ) { |
|---|
| 63 | - $post_type = $post->post_type; |
|---|
| 64 | - $current_screen->post_type = $post->post_type; |
|---|
| 65 | - $current_screen->id = $current_screen->post_type; |
|---|
| 66 | - } |
|---|
| 67 | - } |
|---|
| 68 | -} elseif ( isset($_POST['post_type']) ) { |
|---|
| 69 | - $post_type_object = get_post_type_object($_POST['post_type']); |
|---|
| 70 | - if ( $post_type_object ) { |
|---|
| 71 | - $post_type = $post_type_object->name; |
|---|
| 72 | - $current_screen->post_type = $post_type; |
|---|
| 73 | - $current_screen->id = $current_screen->post_type; |
|---|
| 74 | - } |
|---|
| 75 | -} |
|---|
| 76 | +$post = get_post( $post_id ); |
|---|
| 77 | +$post_type_object = get_post_type_object( $current_screen->post_type ); |
|---|
| 78 | +$post_type = $current_screen->post_type; |
|---|
| 79 | |
|---|
| 80 | /** |
|---|
| 81 | * Redirect to previous page. |
|---|
| 82 | Index: wp-admin/admin.php |
|---|
| 83 | =================================================================== |
|---|
| 84 | --- wp-admin/admin.php (revision 17436) |
|---|
| 85 | +++ wp-admin/admin.php (working copy) |
|---|
| 86 | @@ -88,13 +88,13 @@ |
|---|
| 87 | $plugin_page = plugin_basename($plugin_page); |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | -if ( isset($_GET['post_type']) ) |
|---|
| 91 | - $typenow = sanitize_key($_GET['post_type']); |
|---|
| 92 | +if ( isset($_REQUEST['post_type']) ) |
|---|
| 93 | + $typenow = sanitize_key( $_REQUEST['post_type'] ); |
|---|
| 94 | else |
|---|
| 95 | $typenow = ''; |
|---|
| 96 | |
|---|
| 97 | if ( isset($_GET['taxonomy']) ) |
|---|
| 98 | - $taxnow = sanitize_key($_GET['taxonomy']); |
|---|
| 99 | + $taxnow = sanitize_key( $_GET['taxonomy'] ); |
|---|
| 100 | else |
|---|
| 101 | $taxnow = ''; |
|---|
| 102 | |
|---|