diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 2db199847..203e3453a 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -9,17 +9,6 @@ /** WordPress Administration Bootstrap */ require_once('admin.php'); -if ( !current_user_can('edit_posts') ) - wp_die(__('Cheatin’ uh?')); - -// Back-compat for viewing comments of an entry -if ( $_redirect = intval( max( @$_GET['p'], @$_GET['attachment_id'], @$_GET['page_id'] ) ) ) { - wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) ); - exit; -} else { - unset( $_redirect ); -} - if ( !isset($_GET['post_type']) ) $post_type = 'post'; elseif ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) ) @@ -30,6 +19,17 @@ $_GET['post_type'] = $post_type; $post_type_object = get_post_type_object($post_type); +if ( !current_user_can($post_type_object->edit_type_cap) ) + wp_die(__('Cheatin’ uh?')); + +// Back-compat for viewing comments of an entry +if ( $_redirect = intval( max( @$_GET['p'], @$_GET['attachment_id'], @$_GET['page_id'] ) ) ) { + wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) ); + exit; +} else { + unset( $_redirect ); +} + if ( 'post' != $post_type ) { $parent_file = "edit.php?post_type=$post_type"; $submenu_file = "edit.php?post_type=$post_type"; diff --git a/wp-admin/menu.php b/wp-admin/menu.php index fc00b1fee..56145d995 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -118,9 +118,9 @@ foreach ( (array) get_post_types( array('show_ui' => true) ) as $ptype ) { $ptype_obj = get_post_type_object($ptype); $menu[$_wp_last_object_menu] = array(esc_attr($ptype_obj->label), $ptype_obj->edit_type_cap, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-posts', 'menu-' . sanitize_html_class($ptype), 'div'); - $submenu["edit.php?post_type=$ptype"][5] = array( __('Edit'), 'edit_posts', "edit.php?post_type=$ptype"); + $submenu["edit.php?post_type=$ptype"][5] = array( __('Edit'), $ptype_obj->edit_type_cap, "edit.php?post_type=$ptype"); /* translators: add new custom post type */ - $submenu["edit.php?post_type=$ptype"][10] = array( _x('Add New', 'post'), 'edit_posts', "post-new.php?post_type=$ptype" ); + $submenu["edit.php?post_type=$ptype"][10] = array( _x('Add New', 'post'), $ptype_obj->edit_type_cap, "post-new.php?post_type=$ptype" ); $i = 15; foreach ( $wp_taxonomies as $tax ) {