From b0443feba31782984987956a89cfa8c2df38d0e5 Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 23 Oct 2010 18:16:41 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index dcdd36b83..0332372fa 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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;