Skip to content

Instantly share code, notes, and snippets.

@hlashbrooke
Created July 14, 2014 15:44
Show Gist options
  • Save hlashbrooke/56d2c51d8c77b95538a6 to your computer and use it in GitHub Desktop.
Save hlashbrooke/56d2c51d8c77b95538a6 to your computer and use it in GitHub Desktop.
Sensei - Disable "Pass required to complete lesson" on all lessons. Add this to your theme's functions.php file and then load any frontend page on the site. After that you must remove the code from your site.
<?php
add_action( 'init', 'sensei_disable_pass_required_all_lessons' );
function sensei_disable_pass_required_all_lessons() {
if( is_admin() ) {
return;
}
global $woothemes_sensei;
$args = array(
'post_type' => 'lesson',
'posts_per_page' => -1,
);
$lessons = get_posts( $args );
foreach( $lessons as $lesson ) {
$quizzes = $woothemes_sensei->frontend->lesson->lesson_quizzes( $lesson->ID );
foreach( $quizzes as $quiz ) {
update_post_meta( $quiz->ID, '_pass_required', '' );
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment