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.
Opens WPIDE on
Code
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 add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.