Last active
July 13, 2022 18:27
-
-
Save lelandf/0f3c48763960922c7a79c53ed6939d14 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 | |
// UPDATE: I wouldn't use this anymore | |
// UPDATE: I would use this instead: https://developers.learndash.com/constant/learndash_default_course_price_type/ | |
function leland_learndash_set_default_course_access_setting( $options_fields ) { | |
global $pagenow; | |
if ( "post-new.php" === $pagenow && "sfwd-courses" === get_post_type() ) { | |
foreach ( $options_fields as &$option_field ) { | |
if ( "course_price_type" === $option_field["name"] ) { | |
$option_field["value"] = "free"; | |
} | |
} | |
} | |
return $options_fields; | |
} | |
add_filter( 'learndash_settings_fields', 'leland_learndash_set_default_course_access_setting', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment