GeneralSiteNetworkDomainPathSearchTypePaginationOrderCountReturn FieldsCacheOverviewUse this tool to create custom code for WordPress Site Query with WP_Site_Query class.UsageFill in the user-friendly form.Click the “Update Code” button.Copy the code to your project.Or save it as a snippet and share with the community.ExamplesIf you are still learning how to use this tool, check out the following examples:Search specific sitesReturn network sitesReturn sites by domainsReturn only public sitesReturn deleted sites IDsQuery Variable Name The variable used in the code.Show The Loop YesNo Show the site loop.Site ID Return single site by ID.Sites IDs In Use comma separated list of sites IDs to include.Sites IDs Not In Use comma separated list of sites IDs to exclude.Network ID Return sites from a given network. To include all networks use 0. Default 0.Network IDs In Use comma separated list of network IDs to include.Network IDs Not In Use comma separated list of network IDs to exclude.Domain Return sites from a given domain.Domains In Use comma separated list of domains to include.Domains Not In Use comma separated list of domains to exclude.Path Return sites from a given path.Paths In Use comma separated list of paths to include.Paths Not In Use comma separated list of paths to exclude.Search Return sites matching the search criteria.Search Columns Comma separated list of column names to be searched. Accepts 'domain' and 'path'. Default empty.Public Choose...TrueFalse - Default Return public sites only.Archived Choose...TrueFalse - Default Return archived sites only.Mature Choose...TrueFalse - Default Return mature sites only.Spam Choose...TrueFalse - Default Return spam sites only.Deleted Choose...TrueFalse - Default Return deleted sites only.Number Number of sites to return.Offset Number of sites to displace or pass over.Order Choose...ASC - DefaultDESC Ascending or Descending order.Order by Choose...Site ID (default)Site IDs InNetwork IDNetwork IDs InDomainDomain LengthPathPath LengthRegisteration DateLast UpdatedNone Sort retrieved sites by.Counts Choose...TrueFalse - Default Whether to return a site count (true) or array of site objects (false).Return Fields All fields (Default)Site IDs Site fields to return.Sites Cache Choose...TrueFalse - Default Whether to prime the cache for found sitesNo Found Rows Choose...True - DefaultFalse Whether to disable the "SQL_CALC_FOUND_ROWS" query. Update Code Save Snippet
// WP_Site_Query arguments $args = array( ); // The Site Query $site_query = new WP_Site_Query( $args );