Skip to content

Instantly share code, notes, and snippets.

@onwp
Forked from lelandf/snippet.php
Created September 9, 2021 21:46
Show Gist options
  • Save onwp/9f22337fd8cd294c71425297ee67baf5 to your computer and use it in GitHub Desktop.
Save onwp/9f22337fd8cd294c71425297ee67baf5 to your computer and use it in GitHub Desktop.
Add custom field support to LearnDash post types
// https://developer.wordpress.org/reference/functions/add_post_type_support/
add_action( 'init', 'lelandf_custom_fields_support_learndash' );
function lelandf_custom_fields_support_learndash() {
$post_types = [
'sfwd-courses',
'sfwd-lessons',
'sfwd-topic',
];
foreach ( $post_types as $post_type ) {
add_post_type_support( $post_type, 'custom-fields' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment