# Noindex Page 2 and Beyond With Yoast

> Tells search engines not to index paginated archive pages (page 2, 3 and so on) while still following their links, using Yoast SEO's robots meta.

- Type: PHP
- Runs: Frontend only
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: yoast, noindex, pagination
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/yoast-noindex-paged-archives/

## Code

```php
add_filter( 'wpseo_robots_array', function ( $robots ) {
    if ( is_paged() && is_array( $robots ) ) {
        $robots['index']  = 'noindex';
        $robots['follow'] = 'follow';
    }

    return $robots;
} );
```

## Notes

The first page of every archive stays indexable.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Noindex Page 2 and Beyond With Yoast" 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/
