Changeset 46251 for trunk/src/wp-includes/ms-blogs.php
- Timestamp:
- 09/23/2019 05:34:20 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-blogs.php
r45794 r46251 854 854 update_posts_count(); 855 855 } 856 857 /** 858 * Count number of sites grouped by site status. 859 * 860 * @since 5.3.0 861 * 862 * @param int $network_id The network to get counts for. Default is the current network id. 863 * @return array Includes a grand total 'all' and an array of counts indexed by 864 * status strings: public, archived, mature, spam, deleted. 865 */ 866 function wp_count_sites( $network_id = null ) { 867 if ( empty( $network_id ) ) { 868 $network_id = get_current_network_id(); 869 } 870 871 $counts = array(); 872 $args = array( 873 'network_id' => $network_id, 874 'number' => 1, 875 'fields' => 'ids', 876 'no_found_rows' => false, 877 ); 878 879 $q = new WP_Site_Query( $args ); 880 $counts['all'] = $q->found_sites; 881 882 $_args = $args; 883 $statuses = array( 'public', 'archived', 'mature', 'spam', 'deleted' ); 884 885 foreach ( $statuses as $status ) { 886 $_args = $args; 887 $_args[ $status ] = 1; 888 889 $q = new WP_Site_Query( $_args ); 890 $counts[ $status ] = $q->found_sites; 891 } 892 893 return $counts; 894 }
Note: See TracChangeset
for help on using the changeset viewer.