How To Bypass Wishlist Member Protection for Posts or Pages?
Wishlist Member allows you to choose what for which custom post types you want to enable the Wishlist Member protection settings.
If you want to enable the Wishlist Member protection settings for specific custom post type, you can easily do it by enabling it inside Wishlist Member Settings -> Custom Post Type and select the post type you want protect by Wishlist Member protection.
But what can you do if want to exclude the default post types (posts, pages) from Wishlist Member protection.
Achieving that could be a little bit tricky and you need to use some code to enable this functionality.
The function inside Wishlist Member that decide whether or not a specific content will be displayed to a visitor is located inside the wpm.php located in the root folder of the Wishlist Member plugin.
You can disable the function checking by adding a special code at the beginning of them function code and technically tell the function to return the template for the specific content without checking the protection settings.
If you want to disable the protection checking all posts add this code at the beginning of them function:
1 |
if(get_post_type() == ‘post’) return $template; |
If you want to disable the protection checking all pages add this code at the beginning of them function:
1 |
if(get_post_type() == ‘page’) return $template; |
If you want to disable the protection checking both for posts and pages add this code at the beginning of them function:
1 |
if(get_post_type() == ‘post’ || get_post_type() == ‘page’) return $template; |
If you are using this code and changing the wpm.php file, you should know few things:
- Wishlist Member will not support custom or modified code inside the Wishlist Member plugin.
- When Wishlist Member will release a new version these changes will be deleted, and you will need to add them again.
If you are looking for more custom solution for Wishlist Member membership site send us a quote request using the request a quote form.