<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[회원관리 플러그인 페이지 제한 부모-자식 페이지 적용 관련]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/62715</link>
		<description><![CDATA[<p><strong>1. 정확한 제품 또는 플러그인 이름</strong></p>

<p>코스모스팜 회원관리 최신버전</p>

<p> </p>

<p><strong>2. 상세 내용</strong></p>

<p>안녕하세요. 아래 코드를 자식테마 functions.php 파일에 넣어서 부모 페이지의 아이디만 입력하면 그 아래 자식 페이지까지 모두 비회원 접근제한이 되도록 만들었습니다.</p>

<p>그런데 회원관리 플러그인의 기능 중 하나인, 페이지 수정에서 '페이지 제한'이 있잖아요? 사용자 역할을 지정해서 해당 역할을 가진 회원만 접근 가능하도록 하는 것인데, 이 기능을 부모 페이지에 설정하면 그 아래 자식 페이지까지 모두 설정이 적용되도록 하고 싶습니다. 아래 코드를 응용하면 될 것 같은데, 코스모스팜 회원관리 플러그인 어느 파일 어느 라인을 어떻게 수정해야 할까요?</p>

<pre>
<code class="language-php">//부모 페이지와 자식페이지 모두 비회원 접근제한
add_action('template_redirect', 'redirect_to_specific_page');
function redirect_to_specific_page() {
  $parent_ids = array( 460, 2427, 3695, 10202);
  $child_pages = array();
  
  // loop through the parent pages
  foreach ($parent_ids as $parent_id) {
    // Get all child pages of the parent page
    $args = array(
      'post_type' =&gt; 'page',
      'post_parent' =&gt; $parent_id,
      'posts_per_page' =&gt; -1,
      'fields' =&gt; 'ids'
    );
    $child_pages = array_merge($child_pages, get_posts($args));
  }
  // Add the parent page IDs to the array of child pages
  $child_pages = array_merge($child_pages, $parent_ids);
  
  if ( is_page( $child_pages ) &amp;&amp; !is_user_logged_in()) {
    $return_url = esc_url( home_url( '/login/' ) ); // Redirect to your custom login page in WordPress
    wp_redirect( $return_url );
    exit;
  }
}</code></pre>

<p> </p>

<p> </p>

<p> </p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[안녕하세요~^^

회원관리 플러그인에서 페이지 제한 기능은

the_content 필터를 사용하고 있으며

해당...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/62728</link>
			<description><![CDATA[<p>안녕하세요~^^</p>

<p>회원관리 플러그인에서 페이지 제한 기능은</p>

<p>the_content 필터를 사용하고 있으며</p>

<p>해당 코드는 plugins/cosmosfarm-members/class/Cosmosfarm_Members.class.php 파일의</p>

<p>page_restriction 함수에서 확인하실 수 있습니다.</p>

<p>고맙습니다.</p>]]></description>
			<author>스레드봇</author>
			<pubDate>Wed, 11 Jan 2023 10:49:59 +0000</pubDate>
			<category>워드프레스</category>
		</item>
			</channel>
</rss>