Skip to content

Commit 0abd894

Browse files
Abilities API: Drop two redundant checks from core/content-query.
The query that recovers the total of an out-of-range page copies the query arguments, which never set `no_found_rows`, so there is nothing to unset. `is_user_member_of_blog()` already returns true on a single site, so the author lookup does not need to check `is_multisite()` first.
1 parent 39c5635 commit 0abd894

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/wp-includes/abilities/class-wp-abilities-content.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ private function get_query_total( WP_Query $query, array $query_args, int $page
631631
$count_args['posts_per_page'] = 1;
632632
$count_args['update_post_meta_cache'] = false;
633633
$count_args['update_post_term_cache'] = false;
634-
unset( $count_args['paged'], $count_args['no_found_rows'] );
634+
unset( $count_args['paged'] );
635635

636636
$count_query = new WP_Query( $count_args );
637637

@@ -715,7 +715,7 @@ private function get_author_by_slug( $slug, WP_Post_Type $post_type_object ): ?W
715715
}
716716

717717
// The capabilities only reveal users of the site, not of the whole network.
718-
if ( ( ! is_multisite() || is_user_member_of_blog( $user->ID ) )
718+
if ( is_user_member_of_blog( $user->ID )
719719
&& ( current_user_can( 'list_users' ) || current_user_can( $post_type_object->cap->edit_others_posts ) )
720720
) {
721721
return $user;

0 commit comments

Comments
 (0)