Title: get_blog_count
Published: April 25, 2014
Last modified: May 20, 2026

---

# get_blog_count( int|null $network_id = null ): int

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#wp--skip-link--target)

Gets the number of active sites on the installation.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#description)󠁿

The count is cached and updated twice daily. This is not a live count.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_blog_count/?output_format=md#parameters)󠁿

 `$network_id`int|nulloptional

ID of the network. Default is the current network.

Default:`null`

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

 int Number of active sites on the network.

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

    ```php
    function get_blog_count( $network_id = null ) {
    	return get_network_option( $network_id, 'blog_count' );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ms-functions.php#L124)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ms-functions.php#L124-L126)

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

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

Retrieves a network’s option value based on the option name.

  |

| Used by | Description | 
| [WP_Debug_Data::get_wp_core()](https://developer.wordpress.org/reference/classes/wp_debug_data/get_wp_core/)`wp-admin/includes/class-wp-debug-data.php` |

Gets the WordPress core section of the debug data.

  | 
| [wp_network_dashboard_right_now()](https://developer.wordpress.org/reference/functions/wp_network_dashboard_right_now/)`wp-admin/includes/dashboard.php` |  | 
| [wp_version_check()](https://developer.wordpress.org/reference/functions/wp_version_check/)`wp-includes/update.php` |

Checks WordPress version against the newest version.

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

Determines whether or not we have a large network.

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

Gets the network’s site and user counts.

  |

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

| Version | Description | 
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | MU (3.0.0) | 
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | The `$network_id` parameter is now being used. | 
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |

## User Contributed Notes

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