# LearnDash: Stop Search Engines Indexing Lessons

> Tells search engines not to index LearnDash lessons, topics, quizzes and certificates, which are usually locked and only show a login message to crawlers.

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

## Code

```php
if ( ! defined( 'LEARNDASH_VERSION' ) ) {
    return;
}

add_filter( 'wp_robots', function ( $robots ) {
    if ( is_singular( array( 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz', 'sfwd-certificates' ) ) ) {
        $robots['noindex'] = true;
        $robots['follow']  = true;
    }

    return $robots;
} );
```

## Notes

Links on those pages are still followed. Course pages stay indexable.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "LearnDash: Stop Search Engines Indexing Lessons" 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/
