Created
January 21, 2021 18:06
-
-
Save eri-trabiccolo/f94fdc46b76a90629d7e5a84aa8dcd48 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 // <- do not copy this line. | |
/** | |
* This will prevent old lessons and lessons created with the course builder to have blocks added. | |
*/ | |
add_filter( | |
'llms_blocks_should_migrate_post', | |
function( $ret, $post_id ) { | |
return $post_id && 'lesson' === get_post_type( $post_id ) ? false : $ret; | |
}, | |
10, | |
2 | |
); | |
/** | |
* It will, prevent lesson's template elements to be directly shown in front via hooks. | |
*/ | |
add_filter( | |
'llms_blocks_is_post_migrated', | |
function( $ret, $post_id ) { | |
return $post_id && 'lesson' === get_post_type( $post_id ) ? true : $ret; | |
}, | |
10, | |
2 | |
); | |
/** | |
* This will unset the block editor template for the lessons created via wp admin Lessons -> Add New: | |
* block will not be added directly in the editor. | |
*/ | |
add_filter( | |
'lifterlms_register_post_type_lesson', | |
function ( $lesson_type_array ) { | |
unset( $lesson_type_array['template'] ); | |
return $lesson_type_array; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment