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

git-svn-id: https://develop.svn.wordpress.org/trunk@19321 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2011-11-17 18:01:08 +00:00
parent 914a945108
commit f626327800
4 changed files with 21 additions and 30 deletions

View File

@@ -9,19 +9,17 @@
/** WordPress Administration Bootstrap */
require_once( './admin.php' );
if ( !isset($_GET['post_type']) )
$post_type = 'post';
elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) )
$post_type = $_GET['post_type'];
else
wp_die( __('Invalid post type') );
$_GET['post_type'] = $post_type;
if ( ! $typenow )
wp_die( __( 'Invalid post type' ) );
$post_type = $typenow;
$post_type_object = get_post_type_object( $post_type );
if ( !current_user_can($post_type_object->cap->edit_posts) )
wp_die(__('Cheatin’ uh?'));
if ( ! $post_type_object )
wp_die( __( 'Invalid post type' ) );
if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
wp_die( __( 'Cheatin’ uh?' ) );
$wp_list_table = _get_list_table('WP_Posts_List_Table');
$pagenum = $wp_list_table->get_pagenum();