Created
July 14, 2014 15:44
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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