Title: get_network
Published: August 16, 2016
Last modified: February 24, 2026

---

# get_network( WP_Network|int|null $network = null ): 󠀁[WP_Network](https://developer.wordpress.org/reference/classes/wp_network/)󠁿|null

## In this article

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

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

Retrieves network data given a network ID or network object.

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

Network data will be cached and returned after being passed through a filter.
If
the provided network is empty, the current network global will be used.

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

 `$network`[WP_Network](https://developer.wordpress.org/reference/classes/wp_network/)
|int|nulloptional

Network to retrieve. Default is the current network.

Default:`null`

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

 [WP_Network](https://developer.wordpress.org/reference/classes/wp_network/)|null
The network object or null if not found.

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

    ```php
    function get_network( $network = null ) {
    	global $current_site;
    	if ( empty( $network ) && isset( $current_site ) ) {
    		$network = $current_site;
    	}

    	if ( $network instanceof WP_Network ) {
    		$_network = $network;
    	} elseif ( is_object( $network ) ) {
    		$_network = new WP_Network( $network );
    	} else {
    		$_network = WP_Network::get_instance( $network );
    	}

    	if ( ! $_network ) {
    		return null;
    	}

    	/**
    	 * Fires after a network is retrieved.
    	 *
    	 * @since 4.6.0
    	 *
    	 * @param WP_Network $_network Network data.
    	 */
    	$_network = apply_filters( 'get_network', $_network );

    	return $_network;
    }
    ```

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

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_network/?output_format=md#hooks)󠁿

 [apply_filters( ‘get_network’, WP_Network $_network )](https://developer.wordpress.org/reference/hooks/get_network/)

Fires after a network is retrieved.

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

| Uses | Description | 
| [WP_Network::__construct()](https://developer.wordpress.org/reference/classes/wp_network/__construct/)`wp-includes/class-wp-network.php` |

Creates a new [WP_Network](https://developer.wordpress.org/reference/classes/wp_network/) object.

  | 
| [WP_Network::get_instance()](https://developer.wordpress.org/reference/classes/wp_network/get_instance/)`wp-includes/class-wp-network.php` |

Retrieves a network from the database by its ID.

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

Calls the callback functions that have been added to a filter hook.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/get_network/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_network/?output_format=md#)

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

Notifies the Multisite network administrator that a new site was created.

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

Runs the initialization routine for a given site.

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

Retrieves the oEmbed response data for a given URL.

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

Gets the main site ID.

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

Retrieves the current network ID.

  | 
| [WP_Network_Query::get_networks()](https://developer.wordpress.org/reference/classes/wp_network_query/get_networks/)`wp-includes/class-wp-network-query.php` |

Gets a list of networks matching the query vars.

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

Gets the main network ID.

  | 
| [WP_MS_Users_List_Table::column_blogs()](https://developer.wordpress.org/reference/classes/wp_ms_users_list_table/column_blogs/)`wp-admin/includes/class-wp-ms-users-list-table.php` |

Handles the sites column output.

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

Handles sending a password retrieval email to a user.

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

Shows a form for returning users to sign up for another site.

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

Shows a form for a visitor to sign up for a new user account.

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

Generates and displays the Sign-up and Create Site forms.

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

Deletes a site.

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

Populate network settings.

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

Creates the initial content for a newly-installed site.

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

Retrieves the site URL for the current network.

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

Retrieves the home URL for the current network.

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

Adds any domain in a multisite installation for safe HTTP requests to the allowed list.

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

Adds the “Site Name” menu.

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

Adds a newly created user to the appropriate blog

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

Corrects From host on outgoing mail to match the site domain.

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

Notifies a user that their account activation has been successful.

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

Ensures that the current site’s domain is listed in the allowed redirect host list.

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

Notifies the site administrator that their site activation was successful.

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

Install an empty blog.

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

Processes new site registrations.

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

Retrieves an object containing information about the requested network.

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

Checks status of current blog.

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

Get the “dashboard blog”, the blog where users without a blog edit their profile data.

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

Retrieves a site’s ID given its (subdomain or directory) slug.

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

Defines Multisite cookie constants.

  |

[Show 26 more](https://developer.wordpress.org/reference/functions/get_network/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_network/?output_format=md#)

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

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

## User Contributed Notes

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