Membership 플러그인에서 page, post 접근제한 버그문제

다음과 같이 redirect() 구문을 추가해 주는 방법이 있다.

/wordpress/plugins/membership/membershipincludes/includes/default.rules.php

class M_Posts extends M_Rule {...} 에서

function add_unviewable_posts($wp_query) {

    if(!in_array($wp_query->query_vars['post_type'], array('post','')) || !empty($wp_query->query_vars['pagename'])) {
        return;
    }

    foreach( (array) $this->data as $key => $value ) {
        $wp_query->query_vars['post__not_in'][] = $value;
    }

    $wp_query->query_vars['post__not_in'] = array_unique($wp_query->query_vars['post__not_in']);
    
    if(in_array($wp_query->query_vars['p'], $wp_query->query_vars['post__not_in'])) {
        $this->redirect();
    }

}

function redirect() {
    global $M_options;
    $url = get_permalink( (int) $M_options['nocontent_page'] );
    wp_safe_redirect( $url );
    exit;
}

class M_Pages extends M_Rule {...} 에서

function add_unviewable_pages($wp_query) {
    if(!in_array($wp_query->query_vars['post_type'], array('page','')) || empty($wp_query->query_vars['pagename'])) {
        //return;
    }

    foreach( (array) $this->data as $key => $value ) {
        $wp_query->query_vars['post__not_in'][] = $value;
    }

    $wp_query->query_vars['post__not_in'] = array_unique($wp_query->query_vars['post__not_in']);

    if(in_array($wp_query->query_vars['page_id'], $wp_query->query_vars['post__not_in'])) {
        $this->redirect();
    }
}

function redirect() {
    global $M_options;
    $url = get_permalink( (int) $M_options['nocontent_page'] );
    wp_safe_redirect( $url );
    exit;
}