From 4d0164db91be91d891a781fc175526efeb597e6f Mon Sep 17 00:00:00 2001 From: Andrew 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: https://develop.svn.wordpress.org/trunk@15935 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 dcdd36b83a..0332372fa1 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;