# Hide New Network Sites From Search Engines

> Sets every newly created site to "Discourage search engines" so half-built sites are not indexed; site owners switch it off when they launch.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: new-site, seo, noindex
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-new-site-discourage-search/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

add_action( 'wp_initialize_site', function ( $site ) {
    update_blog_status( $site->blog_id, 'public', 0 );

    switch_to_blog( $site->blog_id );
    update_option( 'blog_public', 0 );
    restore_current_blog();
}, 200 );
```

## Notes

Pair it with the "Search engines" column snippet to see which sites still need switching on.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide New Network Sites From Search Engines" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
