Remove some capability_type code in WP_Query. Only build faux caps if we're querying for multiple post types or if the post type object can't be found. see #14122.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-10-23 18:16:41 +00:00
parent f244d99609
commit b0443feba3
1 changed files with 4 additions and 7 deletions

View File

@ -2033,13 +2033,11 @@ class WP_Query extends WP_Object_Query {
$q['orderby'] = "$wpdb->posts.post_date ".$q['order'];
}
if ( is_array($post_type) ) {
if ( is_array( $post_type ) ) {
$post_type_cap = 'multiple_post_type';
} else {
$post_type_object = get_post_type_object ( $post_type );
if ( !empty($post_type_object) )
$post_type_cap = $post_type_object->capability_type;
else
$post_type_object = get_post_type_object( $post_type );
if ( empty( $post_type_object ) )
$post_type_cap = $post_type;
}
@ -2066,8 +2064,7 @@ class WP_Query extends WP_Object_Query {
$post_type_object = get_post_type_object ( 'post' );
}
if ( !empty($post_type_object) ) {
$post_type_cap = $post_type_object->capability_type;
if ( ! empty( $post_type_object ) ) {
$edit_cap = $post_type_object->cap->edit_post;
$read_cap = $post_type_object->cap->read_post;
$edit_others_cap = $post_type_object->cap->edit_others_posts;