<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[권한에 따라 다른페이지로 리다이렉션 문의]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/44270</link>
		<description><![CDATA[<p>안녕하세요. 코스모스팜 잘 이용하고 있습니다 !</p>

<p>WP-Members 플러그인과 코스모스팜 회원관리 플러그인으로 Uer role 에 따라 다른 페이지로 리다이렉션 하고 싶은데 페이지를 볼 수 있는 권한만 설정할 수 있는 것 같아 문의 드립니다.</p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[안녕하세요~^^

아래 코드를 응용해보시겠어요?

코드는 테마의 functions.php 파일에 추가해주세요.


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

<p>아래 코드를 응용해보시겠어요?</p>

<p>코드는 테마의 functions.php 파일에 추가해주세요.</p>

<pre>
<code class="language-php">add_action('template_redirect', 'my_template_redirect_20200619');
function my_template_redirect_20200619(){
	global $post;
	
	if($post-&gt;ID == '1'){ // 실제 페이지 ID로 교체
		
		if(is_user_logged_in()){ // 로그인 했는지 체크
			$current_user = wp_get_current_user();
			$role = (array) $current_user-&gt;roles;
			
			if(!in_array('administrator', $role)){ // 사용자 역할 체크
				wp_redirect('/');
				exit;
			}
		}
		else{
			wp_redirect('/');
			exit;
		}
	}
}</code></pre>

<p>워드프레스 관리자 -&gt; 테마 디자인 -&gt; 테마 편집기 메뉴에서 functions.php 파일을 편집할 수 있습니다.</p>

<p>고맙습니다.</p>]]></description>
			<author>스레드봇</author>
			<pubDate>Fri, 19 Jun 2020 01:54:15 +0000</pubDate>
			<category>워드프레스</category>
		</item>
			</channel>
</rss>