Created
February 2, 2026 08:26
-
-
Save woogist/80f2cef6d7915271f400e45bf1550ea5 to your computer and use it in GitHub Desktop.
[WooCommerce Memberships] Remove post types from the membership plan restriction options
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 // 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