유튜브 삽입시 에디터 오류가 있습니다.

워드프레스 케이보드 게시판 사용중입니다. 

게시판글 작성시 본문에 링크를 삽입하거나, 유튜브 동영상 링크를 삽입하면 

">

본문에 위 문자가 포함되서 나옵니다.

https://imgur.com/a/OTpxtjX

사진 첨부 합니다. 어떻게 해결할 수 있을까요?

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

    업데이트를 할 수 없는 상황이시라면

    FTP로 접속해서 /wp-content/plugins/kboard/helper/Functions.helper.php 파일에

    아래의 코드를 찾아서

    /**
     * 유튜브, 비메오 동영상 URL을 iframe 코드로 변환한다.
     * @param string $content
     * @return mixed
     */
    function kboard_video_url_to_iframe($content){
    	// 유튜브
    	$content = preg_replace("/\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i", '<iframe src="https://www.youtube.com/embed/$1" width="560" height="315" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', $content);
    	
    	// 비메오
    	$content = preg_replace("/\s*[a-zA-Z\/\/:\.]*vimeo.com\/(\d+)/i", '<iframe src="https://player.vimeo.com/video/$1" width="560" height="315" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', $content);
    	
    	return $content;
    }

    아래의 코드로 교체해보시겠어요?

    /**
     * 유튜브, 비메오 동영상 URL을 iframe 코드로 변환한다.
     * @param string $content
     * @return mixed
     */
    function kboard_video_url_to_iframe($content){
    	// 유튜브
    	$content = preg_replace('/<a(.*)href=\"[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)">(.*)<\/a>/i', 'https://youtube.com/watch?v=$2', $content);
    	$content = preg_replace("/\s*[a-zA-Z\/\/:\.]*youtube.com\/watch\?v=([a-zA-Z0-9\-_]+)([a-zA-Z0-9\/\*\-\_\?\&\;\%\=\.]*)/i", '<iframe src="https://www.youtube.com/embed/$1" width="560" height="315" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', $content);
    	
    	// 비메오
    	$content = preg_replace('/<a(.*)href=\"[a-zA-Z\/\/:\.]*vimeo.com\/(\d+)">(.*)<\/a>/i', 'https://vimeo.com/$2', $content);
    	$content = preg_replace("/\s*[a-zA-Z\/\/:\.]*vimeo.com\/(\d+)/i", '<iframe src="https://player.vimeo.com/video/$1" width="560" height="315" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', $content);
    	
    	return $content;
    }

    고맙습니다.

  • 지금 수정한 부분이 꽤 있어서 업데이트하긴 위험부담이 큰데 다른 해결 방법 없을까요?
    현재 운영중이라 그렇습니다.

  • 안녕하세요~^^

    사용 중이신 KBoard 플러그인의 버전이 어떻게 되시는지요?

    현재 공식적인 KBoard 플러그인 최신 버전은 5.6 버전입니다.

    최신 버전이 아니라면 업데이트 부탁드립니다.

    업데이트 방법은 아래의 링크를 참고해보세요.

    KBoard(케이보드) 플러그인 업데이트 방법

    고맙습니다.

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요