[Membership 2 Pro] Custom Post Type / Taxonomy Protection

Is there anything special we need to do in order to add protection rules to Custom Post Types and Custom Taxonomies?

We're registering them through traditional methods - we see the add-on for Categories, Custom Posts, and Individual Posts. We've activated those add-ons but are not seeing on a per term or post custom post basis the metabox or area to restrict that post / term to a membership.

Under Protection Rules we see Categories but not Custom Taxonomies. Is there something we can add per term to restrict that term to a certain membership? Is there something we're missing during registration that's preventing them from appearing in Protection Rules?

We also see Custom Post Type Items but all our post types are grouped together and each post individually is missing the content protection box. Is this something we can add in on or after registering the post type via "supports" or "add_meta_box()"?

In the end, we're hoping that we can restrict Custom Post Type Posts and Custom Taxonomy Terms on a per post and per category basis instead of going through the Protection Rules page which groups everything together ( also, it doesn't show our custom taxonomies ).

  • Ash

    Hello IQComputing

    Custom taxonomy protection is not available at the moment I am afraid. So, you can't protect by per taxonomy term. If you have term in the URL, then you can use URL restriction addon to protect a custom post.

    Using custom post type addon, you can protect using Individual Custom Posts addon but yes, that's from protection rule page. There is no meta box in the custom post screen because, many plugin redesigns that page and that breaks the meta box, as a result it produces an error.

    I can't promise, but I am sending your issue to our second level support team. Please note that, they deal with more complex issues, so there might be little delay. We appreciate your patience on this.

    Have a nice day!

    Cheers,
    Ash

  • Ash

    Hello IQComputing

    You can enable the meta box for custom post type by using the code below:

    add_filter( 'ms_controller_membership_metabox_add_meta_boxes_post_types', function( $post_types ) {
    	$post_types[] = 'cpt1';
    	$post_types[] = 'cpt2';
    	$post_types[] = 'cpt3';
    
    	return $post_types;
    } );

    You just need to set the correct CPT term in there.

    You can use this code in your child theme's functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

  • Daniel

    Tried to add this code, but didn't work!

    add_filter( 'ms_controller_membership_metabox_add_meta_boxes_post_types', function( $post_types ) {
    		$post_types[] = 'lives';
    
    		return $post_types;
    	} );

    I tried to activate Individual Posts Protection Add-on and Individual custom posts protection add-on, but still nothing.

    I actually have the same issue, wanted to add protection to custom taxonomy terms for my custom post type. I'm using PODS to create new custom posts types and taxonomies.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.