Created
November 25, 2024 19:35
-
-
Save kimcoleman/c8701f4d791beb1d93300bf3076b8cbc to your computer and use it in GitHub Desktop.
Modify the pmpro_lesson post type args to allow comments.
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 | |
function modify_pmpro_lesson_post_type_args($args, $post_type) { | |
// Target only the 'pmpro_lesson' post type | |
if ($post_type === 'pmpro_lesson') { | |
// Merge 'comments' (discussion) support into the 'supports' array | |
if (isset($args['supports']) && is_array($args['supports'])) { | |
$args['supports'][] = 'comments'; // Add 'comments' support | |
} else { | |
$args['supports'] = array('comments'); // Create the supports array if it doesn't exist | |
} | |
} | |
return $args; | |
} | |
add_filter('register_post_type_args', 'modify_pmpro_lesson_post_type_args', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment