Enable Paid Membership Pro for custom post types

By default Paid Membership Pro (PMPro) only works for post and page. If you need to enable support for WordPress custom post types, you will need Custom Post Type (CPT) Membership Access addon, which is part of their PMPro Plus Addon – a quite expensive one, if you are used to the free version.

Interestingly, PMPro free version already has the support for custom post types. You just need to enable it. This is what that plus addon does. This can be achieved with a simple code snippet, without the plus addon!

function careless_pmpro_cpt_meta_box() {
    //change CUSTOM_POST_TYPE to your custom post type name
    //copy and duplicate this line - and change CUSTOM_POST_TYPE to your custom post type name - to add pmpro support for your CPTs 
    add_meta_box('pmpro_page_meta', 'Require Membership', 'pmpro_page_meta', 'CUSTOM_POST_TYPE', 'side' );
add_action( 'admin_menu', 'careless_pmpro_cpt_meta_box', 20 );

Above code lets you selectively add support for PMPro to your custom post types.

Code goes in the functions.php file of your active theme.