WordPress.org

Make WordPress Core

Ticket #20601: 20601.diff

File 20601.diff, 602 bytes (added by yoavf, 6 years ago)
  • wp-includes/query.php

     
    23042304                        }
    23052305                        $q['author_name'] = sanitize_title_for_query( $q['author_name'] );
    23062306                        $q['author'] = get_user_by('slug', $q['author_name']);
    2307                         if ( $q['author'] )
     2307                        if ( $q['author'] && is_user_member_of_blog( $q['author']->ID ) )
    23082308                                $q['author'] = $q['author']->ID;
     2309                        else
     2310                                $q['author'] = false;
    23092311                        $whichauthor .= " AND ($wpdb->posts.post_author = " . absint($q['author']) . ')';
    23102312                }
    23112313