wp site list

Lists all sites in a multisite installation.

Options

See the argument syntax reference for a detailed explanation of the syntax conventions used.
[–network=<id>|site_id|network_id]
The network to which the sites belong. --site_id is the name of the column this filters, --network_id is WP_Site_Query’s name for it, and both are accepted as aliases. --network wins when more than one is given.
[–<field>=<value>]
Filter by one or more fields (see “Available Fields” section), or pass any other argument accepted by WP_Site_Query. However, ‘url’ isn’t an available filter, as it comes from ‘home’ in wp_options. Note: ‘–path’ conflicts with the global parameter of the same name; use ‘–site-path’ to filter by path instead.
[–site__in=<value>]
Only list the sites with these blog_id values (comma-separated).
[–site__not_in=<value>]
Exclude the sites with these blog_id values (comma-separated).
[–site_user=<value>]
Only list the sites with this user.
[–site-path=<path>]
Filter by path. Avoids conflict with the global --path parameter.
[–path__in=<value>]
Only list the sites with these paths (comma-separated).
[–path__not_in=<value>]
Exclude the sites with these paths (comma-separated).
[–blog_id=<blog_id>|ID]
Filter by site ID. --ID is WP_Site_Query’s name for the same filter and is accepted as an alias.
[–network__in=<value>]
Only list the sites belonging to these network IDs (comma-separated).
[–network__not_in=<value>]
Exclude the sites belonging to these network IDs (comma-separated).
[–domain=<domain>]
Filter by domain.
[–domain__in=<value>]
Only list the sites with these domains (comma-separated).
[–domain__not_in=<value>]
Exclude the sites with these domains (comma-separated).
[–registered=<date>]
Filter by the date the site was registered. Accepts a timestamp or a date; a value carrying no time of day matches that whole day.
[–last_updated=<date>]
Filter by the date the site was last updated. Accepts a timestamp or a date; a value carrying no time of day matches that whole day.
[–public=<public>]
Filter by whether the site is public. Accepts 1 or 0.
[–archived=<archived>]
Filter by whether the site is archived. Accepts 1 or 0.
[–mature=<mature>]
Filter by whether the site is flagged as mature. Accepts 1 or 0.
[–spam=<spam>]
Filter by whether the site is flagged as spam. Accepts 1 or 0.
[–deleted=<deleted>]
Filter by whether the site is flagged as deleted. Accepts 1 or 0.
[–lang_id=<lang_id>]
Filter by language ID.
[–lang__in=<value>]
Only list the sites with these language IDs (comma-separated).
[–lang__not_in=<value>]
Exclude the sites with these language IDs (comma-separated).
[–search=<string>]
Only list the sites matching this search term. Searches the domain and path columns unless --search_columns narrows it.
[–search_columns=<columns>]
Comma-separated list of columns --search looks in. Accepts ‘domain’ and ‘path’.
[–meta_key=<meta_key>]
Filter by this site meta key. The site meta arguments need WordPress 5.1 or later, which is where multisite gained the table they read.
[–meta_value=<meta_value>]
Filter by this site meta value. Used together with --meta_key.
[–meta_compare=<meta_compare>]
Operator to test the meta value against. Accepts the operators WP_Meta_Query supports, such as ‘=’, ‘!=’, ‘LIKE’ or ‘IN’.
[–meta_type=<meta_type>]
Cast the meta value to this type, such as ‘NUMERIC’ or ‘DATE’.
[–meta_query=<meta_query>]
A WP_Meta_Query clause list, as JSON, for conditions the meta_* arguments above cannot express.
[–date_query=<date_query>]
A WP_Date_Query clause list, as JSON, for ranges --registered and --last_updated cannot express. Giving those as well narrows this further rather than replacing it.
[–number=<number>]
Limit the number of sites returned.
[–offset=<offset>]
Number of sites to skip. Used together with --number.
[–no_found_rows=<no_found_rows>]
Whether to skip counting the total rows the query matches. Accepts 1 or 0.
[–update_site_cache=<update_site_cache>]
Whether to prime the object cache with the sites found. Accepts 1 or 0. Turning it off saves work when listing a large network once.
[–update_site_meta_cache=<update_site_meta_cache>]
Whether to prime the object cache with the site meta of the sites found. Accepts 1 or 0.
[–orderby=<field>]
Order the results by this field, such as ‘blog_id’, ‘domain’, ‘path’, ‘registered’, ‘last_updated’ or ‘site__in’.
[–order=<order>]
Whether to order the results ascending or descending. — options: – asc – desc —
[–field=<field>]
Prints the value of a single field for each site.
[–fields=<fields>]
Comma-separated list of fields to show.
[–format=<format>]
Render output in a particular format. — default: table options: – table – csv – count – ids – json – yaml —

Available Fields

These fields will be displayed by default for each site:
  • blog_id
  • url
  • last_updated
  • registered
These fields are optionally available:
  • site_id
  • domain
  • path
  • public
  • archived
  • mature
  • spam
  • deleted
  • lang_id

Examples

# Output a simple list of site URLs
$ wp site list --field=url
http://www.example.com/
http://www.example.com/subdir/

# Output site URLs, most recently registered first
$ wp site list --orderby=registered --order=desc --field=url
http://www.example.com/subdir/
http://www.example.com/

# Search for sites by domain or path
$ wp site list --search=subdir --field=url
http://www.example.com/subdir/

Global Parameters

These global parameters have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
Argument Description
--path=<path> Path to the WordPress files.
--url=<url> Pretend request came from given URL. In multisite, this argument is how the target site is specified.
--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>] Perform operation against a remote server over SSH (or a container using scheme of “docker”, “docker-compose”, “docker-compose-run”, “vagrant”).
--ssh-args=<args> Pass additional arguments to SSH (or other tools specified by –ssh scheme).
--http=<http> Perform operation against a remote WordPress installation over HTTP.
--user=<id\|login\|email> Set the WordPress user.
--skip-plugins[=<plugins>] Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded.
--skip-themes[=<themes>] Skip loading all themes, or a comma-separated list of themes.
--skip-packages Skip loading all installed packages.
--require=<path> Load PHP file before running the command (may be used more than once).
--exec=<php-code> Execute PHP code before running the command (may be used more than once).
--context=<context> Load WordPress in a given context.
--[no-]color Whether to colorize the output.
--debug[=<group>] Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help.
--prompt[=<assoc>] Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values.
--quiet Suppress informational messages.
--alias=<name> Name of the alias to use. Aliases can reference local WordPress installations or remote SSH connections. Aliases are defined in the wp-cli.yml file.
--assume-https Set $_SERVER[‘HTTPS’] to make WordPress treat the site as HTTPS. Use when WordPress is behind an HTTPS proxy or load balancer.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.