WordPress.org

Make WordPress Core

Ticket #14886: ticket.14886.diff

File ticket.14886.diff, 3.2 KB (added by ptahdunbar, 7 years ago)
  • wp-admin/includes/template.php

     
    20422042 * @param string $id Screen id, optional.
    20432043 */
    20442044function set_current_screen( $id =  '' ) {
    2045         global $current_screen, $hook_suffix, $typenow, $taxnow;
     2045        global $current_screen, $hook_suffix, $typenow, $taxnow, $post_id;
    20462046
    20472047        $action = '';
    20482048
     
    20832083                $current_screen->id .= '-' . $typenow;
    20842084                $current_screen->post_type = $typenow;
    20852085        } elseif ( 'post' == $current_screen->id ) {
     2086                $post_id = isset($_GET['post']) ? (int) $_GET['post'] : 0;
     2087                $post_id = isset($_POST['post_ID']) ? (int) $_POST['post_ID'] : $post_id;
     2088
     2089                if ( $post_id ) {
     2090                        $post = get_post( $post_id );
     2091                        $typenow = $post->post_type;
     2092                }
     2093
    20862094                if ( empty($typenow) )
    20872095                        $typenow = 'post';
    2088                 $current_screen->id = $typenow;
    2089                 $current_screen->post_type = $typenow;
     2096
     2097                $current_screen->id = $current_screen->post_type = $typenow;
    20902098        } elseif ( 'edit-tags' == $current_screen->id ) {
    20912099                if ( empty($taxnow) )
    20922100                        $taxnow = 'post_tag';
     2101                if ( empty($typenow) )
     2102                        $typenow = 'post';
    20932103                $current_screen->id = 'edit-' . $taxnow;
    20942104                $current_screen->taxonomy = $taxnow;
    20952105        }
  • wp-admin/post.php

     
    1616
    1717wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
    1818
    19 if ( isset($_GET['post']) )
    20         $post_id = (int) $_GET['post'];
    21 elseif ( isset($_POST['post_ID']) )
    22         $post_id = (int) $_POST['post_ID'];
    23 else
    24         $post_id = 0;
    25 $post_ID = $post_id;
    26 $post = null;
    27 $post_type_object = null;
    28 $post_type = null;
    29 if ( $post_id ) {
    30         $post = get_post($post_id);
    31         if ( $post ) {
    32                 $post_type_object = get_post_type_object($post->post_type);
    33                 if ( $post_type_object ) {
    34                         $post_type = $post->post_type;
    35                         $current_screen->post_type = $post->post_type;
    36                         $current_screen->id = $current_screen->post_type;
    37                 }
    38         }
    39 } elseif ( isset($_POST['post_type']) ) {
    40         $post_type_object = get_post_type_object($_POST['post_type']);
    41         if ( $post_type_object ) {
    42                 $post_type = $post_type_object->name;
    43                 $current_screen->post_type = $post_type;
    44                 $current_screen->id = $current_screen->post_type;
    45         }
    46 }
     19$post = get_post( $post_id );
     20$post_type_object = get_post_type_object( $current_screen->post_type );
     21$post_type = $current_screen->post_type;
    4722
    4823/**
    4924 * Redirect to previous page.
  • wp-admin/admin.php

     
    8888        $plugin_page = plugin_basename($plugin_page);
    8989}
    9090
    91 if ( isset($_GET['post_type']) )
    92         $typenow = sanitize_key($_GET['post_type']);
     91if ( isset($_REQUEST['post_type']) )
     92        $typenow = sanitize_key( $_REQUEST['post_type'] );
    9393else
    9494        $typenow = '';
    9595
    9696if ( isset($_GET['taxonomy']) )
    97         $taxnow = sanitize_key($_GET['taxonomy']);
     97        $taxnow = sanitize_key( $_GET['taxonomy'] );
    9898else
    9999        $taxnow = '';
    100100