Make WordPress Core


Ignore:
Timestamp:
11/17/2011 06:01:08 PM (14 years ago)
Author:
ryan
Message:

Don't fallback to default post type or taxonomy if given an invalid post type or taxonomy. Use typenow as the canonical post type. Props nacin. see #19131

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r19272 r19321  
    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
    17     wp_die( __('Invalid post type') );
    18 
    19 $_GET['post_type'] = $post_type;
    20 
     12if ( ! $typenow )
     13    wp_die( __( 'Invalid post type' ) );
     14
     15$post_type = $typenow;
    2116$post_type_object = get_post_type_object( $post_type );
    2217
    23 if ( !current_user_can($post_type_object->cap->edit_posts) )
    24     wp_die(__('Cheatin’ uh?'));
     18if ( ! $post_type_object )
     19    wp_die( __( 'Invalid post type' ) );
     20
     21if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
     22    wp_die( __( 'Cheatin’ uh?' ) );
    2523
    2624$wp_list_table = _get_list_table('WP_Posts_List_Table');
Note: See TracChangeset for help on using the changeset viewer.