Title: Custom Post Type Not Protected
Last modified: August 30, 2016

---

# Custom Post Type Not Protected

 *  Resolved [affiliatenow](https://wordpress.org/support/users/affiliatenow/)
 * (@affiliatenow)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/)
 * I have successfully added the custom post type to the “woocommerce-payperpost.
   php” file as follows:
 * `add_meta_box('woocommerce-payperpost-meta-box', __('WooCommerce Pay Per Post','
   textdomain'), __CLASS__ . '::output_meta_box', 'courses', 'normal', 'high');`
 * The Meta Box does show up and I can add the product ID… but the post is not protected.
 * [https://wordpress.org/plugins/woocommerce-pay-per-post/](https://wordpress.org/plugins/woocommerce-pay-per-post/)

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Matt Pramschufer](https://wordpress.org/support/users/mattpramschufer/)
 * (@mattpramschufer)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261451)
 * Do you have an example site that I can look at?
 *  Plugin Author [Matt Pramschufer](https://wordpress.org/support/users/mattpramschufer/)
 * (@mattpramschufer)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261502)
 * I am going to close this thread. If you continue to have issues let me know!
 *  Thread Starter [affiliatenow](https://wordpress.org/support/users/affiliatenow/)
 * (@affiliatenow)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261538)
 * Sorry, I never saw any emails that you updated the case.
 * [https://www.isuccesslab.com/?courses=isuccess-university-orientation](https://www.isuccesslab.com/?courses=isuccess-university-orientation)
 * This is a page that is “protected” by the plugin and I selected that you need
   to purchase product id #172
 * [https://www.isuccesslab.com/product/isuccess-university-orientation/](https://www.isuccesslab.com/product/isuccess-university-orientation/)
 * But the protected page is open to the public, without buying Product ID #172
 * Thank you for your assistance, as this is huge for my site!
 *  Plugin Author [Matt Pramschufer](https://wordpress.org/support/users/mattpramschufer/)
 * (@mattpramschufer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261540)
 * Do you have a temp login and password I could get so I can login and debug for
   you? You can email me at [matt@pramschufer.com](https://wordpress.org/support/topic/custom-post-type-not-protected/matt@pramschufer.com?output_format=md)
 *  Thread Starter [affiliatenow](https://wordpress.org/support/users/affiliatenow/)
 * (@affiliatenow)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261541)
 * That would be great if you could help resolve this… I have emailed you a link
   to access my site!
 *  [it2core](https://wordpress.org/support/users/it2core/)
 * (@it2core)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261542)
 * is possible add this to custom post? i dont see this options in custom post but
   in normal wp post its working.
 *  [it2core](https://wordpress.org/support/users/it2core/)
 * (@it2core)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261543)
 * sorry affiliatenow solution works. but i forgot flush browser cache.
 * Nice 🙂
 *  Thread Starter [affiliatenow](https://wordpress.org/support/users/affiliatenow/)
 * (@affiliatenow)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261544)
 * Well, hopefully we can figure out why my Custom Post types are not being protected.
 *  Plugin Author [Matt Pramschufer](https://wordpress.org/support/users/mattpramschufer/)
 * (@mattpramschufer)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261545)
 * So affiliatenow I am not sure this is going to work with WP Execution Plan. Even
   though it is a custom post type, WPEP doesn’t utilize the standard wordpress 
   the_content(). That is why the PPP plugin hooks into to check and see if user
   has purchased or needs to purchase.
 * The login that you sent me doesn’t allow me to see plugins or make edits to plugin
   so I can’t help you implement a fix. But I was able to do some development on
   my end and found on if you make some changes to the WPEP /lib/inc/templates/courses.
   php we can add in the following at line 22
 *     ```
       $product_id = get_post_meta( $course_id, 'woocommerce_ppp_product_id', true );
   
       if(!\Woocommerce_PayPerPost::checkForProduct($product_id)){
       	echo str_replace( '{{product_id}}', $product_id, get_option( 'wcppp_oops_content' ) );
       } else {
       ```
   
 * and then replace the last line of the file with
 * `<?php } get_footer(); ?>` and this page is now protected.
 *  Thread Starter [affiliatenow](https://wordpress.org/support/users/affiliatenow/)
 * (@affiliatenow)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261546)
 * Brilliant!
 * That now protects the WPEP posts… the only issue I see is that it lists the “
   Product ID” instead of a buy button like on other posts.
 * This Page is restricted to customers that have purchased this product.
    [product
   id=”172″]
 * This is a great product, I hope it keeps up to date with all the crazy WooCommerce
   changes for a long time!
 * P.S. You should have more rights too, sorry about that!
 *  Thread Starter [affiliatenow](https://wordpress.org/support/users/affiliatenow/)
 * (@affiliatenow)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261547)
 * also, not sure if it is related… but it only displays the first product selected
   when I select multiple ID’s

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Custom Post Type Not Protected’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pay-per-post/assets/icon-256x256.png?rev=2252656)
 * [Pay For Post with WooCommerce](https://wordpress.org/plugins/woocommerce-pay-per-post/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pay-per-post/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pay-per-post/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pay-per-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pay-per-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pay-per-post/reviews/)

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)

 * 11 replies
 * 3 participants
 * Last reply from: [affiliatenow](https://wordpress.org/support/users/affiliatenow/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-not-protected/#post-6261547)
 * Status: resolved