여기에서 테스트 할 수있는 사이트 속도 최적화에 사용할 수있는 몇 가지 지침과 코드가 있습니다. https://developers.google.com/speed/pagespeed/insights/?hl=en
- 플러그인을 설치 Autoptimize 다음 옵션을 설정합니다.
- 플러그인을 설치 WP 슈퍼 캐시
- 플러그인을 설치 JPEG 및 PNG 이미지 압축
- 여기에서 옵션 설정 '/wp-admin/options-general.php?page=tinify'
- 플러그인을 설치 퍼가기 금지
- 플러그인을 설치 이모티콘 사용 중지 (GDPR 호환)
- 현재 워드 프레스 테마 파일에 다음 코드 추가 functions.php:123456789101112131415161718192021222324add_filter('autoptimize_html_after_minify', function($content) {$site_url = 'https://YOUR_SITE_LINK_HERE';//do not set slash on the end$content = str_replace("", ' ', $content);$content = str_replace('', ' ', $content);$content = str_replace(" ", ' ', $content);$content = str_replace(' ', ' ', $content);$content = str_replace("rel='stylesheet preload' as='style'", "rel='stylesheet preload'", $content);$content = str_replace('rel="stylesheet preload" as="style"', 'rel="stylesheet preload"', $content);$content = str_replace('@font-face {font-display: swap; ', '@font-face {font-display: swap; font-display: swap;', $content);$content = str_replace('@font-face {font-display: swap; ', '@font-face {font-display: swap; font-display: swap;', $content);$content = str_replace("<img", "<img loading='lazy'", $content);$content = str_replace($site_url . '/wp-includes/js', '/wp-includes/js', $content);$content = str_replace($site_url . '/wp-content/cache/autoptimize', '/wp-content/cache/autoptimize', $content);$content = str_replace($site_url . '/wp-content/themes/', '/wp-content/themes/', $content);$content = str_replace($site_url . '/wp-content/uploads/', '/wp-content/uploads/', $content);$content = str_replace($site_url . '/wp-content/plugins/', '/wp-content/plugins/', $content);return $content;}, 9999, 1);
- 또한 최적화가 가능합니다 jquery.js 제외되는 Autoptimize하지만이 방법이 항상 작동하는 것은 아니므로 다음에 사이트 기능을 확인하십시오.
- 귀하의 사이트에서 현재 wp 테마 파일 functions.php 다음 코드 추가 :1234//exlude jquery to print it in the header by file_get_contentsadd_action('wp_enqueue_scripts', function () {wp_deregister_script('jquery');});
- 귀하의 사이트에서 현재 wp 테마 파일 functions.php 전에 다음 코드 추가 :123<script><?php echo file_get_contents(ABSPATH . WPINC . '/js/jquery/jquery.js'); ?></script>
- 귀하의 사이트에서 현재 wp 테마 파일 functions.php 다음 코드 추가 :
- 신경 쓰다 jquery.js 최적화
