diff --git a/wp-admin/includes/class-wp-ms-sites-list-table.php b/wp-admin/includes/class-wp-ms-sites-list-table.php
index 519a57d8c4..5147139835 100644
--- a/wp-admin/includes/class-wp-ms-sites-list-table.php
+++ b/wp-admin/includes/class-wp-ms-sites-list-table.php
@@ -160,6 +160,12 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
$args['no_found_rows'] = false;
}
+ // Take into account the role the user has selected.
+ $status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
+ if ( in_array( $status, array( 'public', 'archived', 'mature', 'spam', 'deleted' ), true ) ) {
+ $args[ $status ] = 1;
+ }
+
/**
* Filters the arguments for the site query in the sites list table.
*
@@ -201,6 +207,50 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
_e( 'No sites found.' );
}
+ /**
+ * Gets links to filter sites by status.
+ *
+ * @since 5.3.0
+ *
+ * @return array
+ *
+ */
+ protected function get_views() {
+ $counts = wp_count_sites();
+
+ $statuses = array(
+ 'all' => _n_noop( 'All (%s)', 'All (%1$s)' ),
+ 'public' => _n_noop( 'Public (%s)', 'Public (%1$s)' ),
+ 'archived' => _n_noop( 'Archived (%1$s)', 'Archived (%1$s)' ),
+ 'mature' => _n_noop( 'Mature (%1$s)', 'Mature (%1$s)' ),
+ 'spam' => _n_noop( 'Spam (%1$s)', 'Spam (%1$s)' ),
+ 'deleted' => _n_noop( 'Deleted (%1$s)', 'Deleted (%1$s)' ),
+ );
+
+ $view_links = array();
+ $requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
+ $url = 'sites.php';
+
+ foreach ( $statuses as $status => $label_count ) {
+ $current_link_attributes = $requested_status === $status || ( $requested_status === '' && 'all' === $status )
+ ? ' class="current" aria-current="page"'
+ : '';
+ if ( (int) $counts[ $status ] > 0 ) {
+ $label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) );
+ $full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url );
+
+ $view_links[ $status ] = sprintf(
+ '%3$s',
+ esc_url( $full_url ),
+ $current_link_attributes,
+ $label
+ );
+ }
+ }
+
+ return $view_links;
+ }
+
/**
* @return array
*/
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 3ea404c058..1391b5b40e 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
-$wp_version = '5.3-alpha-46253';
+$wp_version = '5.3-alpha-46254';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.