Title: WP_MS_Sites_List_Table::get_views
Published: November 12, 2019
Last modified: August 20, 2026

---

# WP_MS_Sites_List_Table::get_views(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#changelog)

Gets links to filter sites by status.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#return)󠁿

 array

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#source)󠁿

    ```php
    protected function get_views() {
    	$counts = wp_count_sites();

    	$statuses = array(
    		/* translators: %s: Number of sites. */
    		'all'      => _nx_noop(
    			'All <span class="count">(%s)</span>',
    			'All <span class="count">(%s)</span>',
    			'sites'
    		),

    		/* translators: %s: Number of sites. */
    		'public'   => _n_noop(
    			'Public <span class="count">(%s)</span>',
    			'Public <span class="count">(%s)</span>'
    		),

    		/* translators: %s: Number of sites. */
    		'archived' => _n_noop(
    			'Archived <span class="count">(%s)</span>',
    			'Archived <span class="count">(%s)</span>'
    		),

    		/* translators: %s: Number of sites. */
    		'mature'   => _n_noop(
    			'Mature <span class="count">(%s)</span>',
    			'Mature <span class="count">(%s)</span>'
    		),

    		/* translators: %s: Number of sites. */
    		'spam'     => _nx_noop(
    			'Spam <span class="count">(%s)</span>',
    			'Spam <span class="count">(%s)</span>',
    			'sites'
    		),

    		/* translators: %s: Number of sites. */
    		'deleted'  => _n_noop(
    			'Flagged for Deletion <span class="count">(%s)</span>',
    			'Flagged for Deletion <span class="count">(%s)</span>'
    		),
    	);

    	$view_links       = array();
    	$requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
    	$url              = 'sites.php';

    	foreach ( $statuses as $status => $label_count ) {
    		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 ] = array(
    				'url'     => esc_url( $full_url ),
    				'label'   => $label,
    				'current' => $requested_status === $status || ( '' === $requested_status && 'all' === $status ),
    			);
    		}
    	}

    	return $this->get_views_links( $view_links );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-ms-sites-list-table.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/class-wp-ms-sites-list-table.php#L228)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/class-wp-ms-sites-list-table.php#L228-L293)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_count_sites()](https://developer.wordpress.org/reference/functions/wp_count_sites/)`wp-includes/ms-blogs.php` |

Counts number of sites grouped by site status.

  | 
| [_nx_noop()](https://developer.wordpress.org/reference/functions/_nx_noop/)`wp-includes/l10n.php` |

Registers plural strings with gettext context in POT file, but does not translate them.

  | 
| [_n_noop()](https://developer.wordpress.org/reference/functions/_n_noop/)`wp-includes/l10n.php` |

Registers plural strings in POT file, but does not translate them.

  | 
| [translate_nooped_plural()](https://developer.wordpress.org/reference/functions/translate_nooped_plural/)`wp-includes/l10n.php` |

Translates and returns the singular or plural form of a string that’s been registered with [_n_noop()](https://developer.wordpress.org/reference/functions/_n_noop/) or [_nx_noop()](https://developer.wordpress.org/reference/functions/_nx_noop/) .

  | 
| [wp_unslash()](https://developer.wordpress.org/reference/functions/wp_unslash/)`wp-includes/formatting.php` |

Removes slashes from a string or recursively removes slashes from strings within an array.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [number_format_i18n()](https://developer.wordpress.org/reference/functions/number_format_i18n/)`wp-includes/functions.php` |

Converts float number to format based on the locale.

  |

[Show 4 more](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/get_views/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_ms_sites_list_table%2Fget_views%2F)
before being able to contribute a note or feedback.