Home / Archive / MemberPress: Disable MemberPress Protection On Specific Page
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Disable MemberPress Protection On Specific Page

This snippet allows disabling the MemberPress protection (unprotect) on a specific page. The code snippets overrides the MemberPress content protection rules, based on the page slug or ID.

The sample code will remove the protection using both the page slug and ID for different pages. It will make publicly available the page with the your-page slug, and also the page with the ID of 123.

Code Preview
php
<?php
add_filter('mepr-pre-run-rule-content', 'mepr_override_content_protection', 11, 3);
function mepr_override_content_protection($protect, $post, $uri) {
    // Unprotect posts with the specified page slug or ID
    if ( is_page( 'your-page' ) || is_page( 123 ) ) {
        $protect = false; // Disable protection for the specified page
    }
    return $protect;
}

Comments

Add a Comment