WordPress.org

Make WordPress Core

Ticket #19055: 19055.diff

File 19055.diff, 805 bytes (added by kawauso, 2 years ago)

Assign to $post_type, then check if valid

  • wp-admin/edit.php

     
    99/** WordPress Administration Bootstrap */ 
    1010require_once( './admin.php' ); 
    1111 
    12 if ( !isset($_GET['post_type']) ) 
    13         $post_type = 'post'; 
    14 elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) 
    15         $post_type = $_GET['post_type']; 
    16 else 
     12$post_type = isset( $_GET['post_type'] ) ? $_GET['post_type'] : 'post'; 
     13 
     14if ( ! in_array( $post_type, get_post_types( array('show_ui' => true ) ) ) ) 
    1715        wp_die( __('Invalid post type') ); 
    1816 
    19 $_GET['post_type'] = $post_type; 
    20  
    2117$post_type_object = get_post_type_object( $post_type ); 
    2218 
    2319if ( !current_user_can($post_type_object->cap->edit_posts) )