Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save woogist/80f2cef6d7915271f400e45bf1550ea5 to your computer and use it in GitHub Desktop.

Select an option

Save woogist/80f2cef6d7915271f400e45bf1550ea5 to your computer and use it in GitHub Desktop.
[WooCommerce Memberships] Remove post types from the membership plan restriction options
<?php // only copy this line if needed
/**
* Remove post types from the membership plan restriction options
* Example: remove Sensei Messages from post types that can be restricted
*
* @param array $blacklist the array of post types to exclude from restriction options
* @return array $blacklist the updated array of post types to exclude
*/
function sv_wc_memberships_add_post_type_to_blacklist( $blacklist ) {
$blacklist[] = 'sensei_message';
return $blacklist;
}
add_filter( 'wc_memberships_content_restriction_excluded_post_types', 'sv_wc_memberships_add_post_type_to_blacklist' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment