Forked from andrewlimaza/pmpro-lpv-add-my-post-types.php
Last active
April 8, 2021 18:29
-
-
Save travislima/e54ada550bd8526995acbb7260624b6a to your computer and use it in GitHub Desktop.
Add "Pages" to PMPro Limit Post Views
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 // Careful not to copy this php tag. | |
| /** | |
| * Add 'pages' for Limit Post Views Add On for Paid Memberships Pro. You may also add your custom post types using this function below. | |
| * Requires the Paid Memberships Pro - Limit Post Types Add On to work: https://www.paidmembershipspro.com/add-ons/pmpro-limit-post-views/ | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function pmpro_lpv_add_my_post_types( $post_types ) { | |
| // Add pages to post type array to restrict Limit Post Views. | |
| $post_types[] = 'page'; | |
| // $post_types[] = 'custom-post-type'; | Example of how you can add more $post_types | |
| return $post_types; | |
| } | |
| add_filter( 'pmprolpv_post_types', 'pmpro_lpv_add_my_post_types', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Offer limited access to restricted page or CPT content using the Limit Post Views Add On." at Paid Memberships Pro here: https://www.paidmembershipspro.com/offer-limited-access-to-restricted-page-or-custom-post-type-content-using-the-limit-post-views-add-on/