Forked from thomasplevy/llms_membership_restricted_post_types.php
Last active
June 29, 2018 12:50
-
-
Save actual-saurabh/673559f949396e33d28efcfe3f634456 to your computer and use it in GitHub Desktop.
Extend membership restriction to courses, memberships and other post types
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 | |
// Copy from under this line and paste into your child theme's functions.php | |
add_filter( 'llms_membership_restricted_post_types', 'my_membership_restriction_post_types' ); | |
/** | |
* Add LifterLMS membership restrictions to a custom post type | |
* @param array $post_types array of custom post types | |
* @return array | |
*/ | |
function my_membership_restriction_post_types( $default_post_types ) { | |
$post_types_to_restrict = ('llms_membership', 'course', 'event', 'another_post_type'); | |
$updated_post_types = array_merge( $default_post_types, $post_types_to_restrict ); | |
return $updated_post_types; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment