Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lelandf/0f3c48763960922c7a79c53ed6939d14 to your computer and use it in GitHub Desktop.
Save lelandf/0f3c48763960922c7a79c53ed6939d14 to your computer and use it in GitHub Desktop.
<?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