---
title: Filter meta robots attributes
url: "https://www.seopress.org/support/hooks/filter-meta-robots-attributes/"
lang: en-US
updated: 2021-09-29
hook_name: seopress_titles_robots_attrs
required_version: 4.5
---

# Filter meta robots attributes

- **Hook name:** `seopress_titles_robots_attrs`
- **Required version:** 4.5

```php
add_filter('seopress_titles_robots_attrs', 'sp_titles_robots_attrs');
function sp_titles_robots_attrs($attrs) {
    //do your stuff here
    //Eg: apply noindex, follow if a a post has specific categories
    if (has_category(['282', '2', '50'])) {//your category IDs here separate by comma
        unset($attrs);
        $attrs = ['noindex,follow'];
    }
    return $attrs;
}
```

Source: [https://gist.github.com/wp-seopress/a8e9744ae15c4c548d8b2cb5afac6a0a](https://gist.github.com/wp-seopress/a8e9744ae15c4c548d8b2cb5afac6a0a)



