Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thomasplevy/087d4e1b3eaa7ff6f023c88580faa7ef to your computer and use it in GitHub Desktop.
Save thomasplevy/087d4e1b3eaa7ff6f023c88580faa7ef to your computer and use it in GitHub Desktop.
<?php // don't copy this line to your theme's functions.php file
/**
* 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( $post_types ) {
array_push( $post_types, 'my_custom_post_type' );
return $post_types;
}
add_filter( 'llms_membership_restricted_post_types', 'my_membership_restriction_post_types' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment