워드프레스 첫번째글에만 링크거는법에 리다이렉트 걸기

add_filter('the_content', 'my_the_content');
function my_the_content($content){
	global $post;
	
	$recent_posts = wp_get_recent_posts(array('numberposts' => '1'), OBJECT);
	$recent_posts = reset($recent_posts);
	
	if($post->ID && $recent_posts->ID && $post->ID == $recent_posts->ID){
		$rere = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
		if($rere && strpos($rere, "google") !== false || strpos($rere, "naver") !== false || strpos($rere, "daum") !== false){
			$new_content = "링크 => <a href='주소' style='color:red;'>바로가기</a>";
			$new_content .= $content;
			return $new_content;
		}
	}

	return $content;
}

예전에 운영자님이 알려주신 코드 잘 활용을 하고 있는데요.

여기서 <? header("Location: https://naver.com"); ?> 이 코드를 링크 있는곳에 넣어보니 이건또 안되네요.ㅠ.ㅠ

주소를 남기는거 말고 리다이렉트를 저코드에서 활용을 하기 위해선 어떻게 해야 하는지요?

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요