# Noindex Thin Archive Pages

> Adds noindex, follow to date archives, attachment pages and page 2+ of archives, so search engines focus on your real content.

- Type: PHP
- Runs: Run everywhere
- Category: [SEO](https://wpide.com/library/category/seo/)
- Tags: seo, robots, noindex
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/noindex-thin-pages/

## Code

```php
add_filter( 'wp_robots', function ( $robots ) {
    if ( is_date() || is_attachment() || ( is_paged() && ( is_archive() || is_home() ) ) ) {
        $robots['noindex'] = true;
        $robots['follow']  = true;
    }

    return $robots;
} );
```

## Notes

Skip this snippet if an SEO plugin already controls robots meta tags.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Noindex Thin Archive Pages" 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/
