# Tutor LMS: Noindex for Lessons, Quizzes and Assignments

> Adds a noindex instruction to Tutor LMS lessons, quizzes and assignments, which are normally locked and only show crawlers a login wall.

- Type: PHP
- Runs: Frontend only
- Category: [Courses & Community](https://wpide.com/library/category/learning/)
- Tags: tutor, seo, noindex
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/tutor-noindex-lessons/

## Code

```php
if ( ! function_exists( 'tutor' ) ) {
    return;
}

add_filter( 'wp_robots', function ( $robots ) {
    if ( is_singular( array( tutor()->lesson_post_type, 'tutor_quiz', 'tutor_assignments' ) ) ) {
        $robots['noindex'] = true;
        $robots['follow']  = true;
    }

    return $robots;
} );
```

## Notes

Course pages stay indexable.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Tutor LMS: Noindex for Lessons, Quizzes and Assignments" 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/
