# Noindex Category and Tag Pages With Few Posts

> Adds noindex to category, tag and custom taxonomy archives that hold fewer posts than a minimum, so near-empty pages do not dilute your search presence.

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

## Code

```php
// Archives with fewer posts than this get noindex.
$wpide_min_term_posts = 3;

add_filter( 'wp_robots', function ( $robots ) use ( $wpide_min_term_posts ) {
    if ( is_category() || is_tag() || is_tax() ) {
        $term = get_queried_object();

        if ( $term instanceof WP_Term && (int) $term->count < $wpide_min_term_posts ) {
            $robots['noindex'] = true;
            $robots['follow']  = true;
        }
    }

    return $robots;
} );
```

## Notes

Change the minimum number of posts at the top. The pages start being indexed again once they reach it.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Noindex Category and Tag Pages With Few Posts" 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/
