코드 및 디자인 레퍼런스
-
AWS EC2 사용시 NPM 멈춤 현상노트@887.220516
npm 사용 시 인스턴스 멈춤 현상이 있다면 가용 메모리를 체크한다. 대부분 micro 급 이하 인스턴스에서는 메모리가 1G 이하이므로 npm이 정상 작동되지 않을 수 있다. 메모리를 증량하면 정상 작동한다.
-
워드프레스 구텐버그 로드 비활성화노트@867.210806
function smartwp_remove_wp_block_library_css(){ wp_dequeue_style( 'wp-block-library' ); wp_dequeue_style( 'wp-block-library-theme' ); } add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
특정 목적에 따라 워드프레스의 Gutenberg 에디터가 불필요할 경우가 있다. 그럴때 보통 Classic Editor 를 설치하기도 한다. 하지만 프론트엔드에서는 여전히 Gutenberg 관련 스크립트가 로드 되는것을 볼 수 있다. 확실히 Gutenberg를 비활성화하여 사이트 로드를 조금 더 빠르게 하고자할때 사용하면 좋다.
-
OpenLiteSpeed 엔진에서 퍼멀링크 재정의노트@813.210718
OpenLiteSpeed 엔진 사용시 워드프레스 퍼멀링크를 변경하면 오류가 생기는 경우가 있다. Nginx 또는 Apache 엔진은 퍼멀링크 규칙을 변경하면 .htaccess 자동으로 재작성하여 별다른 작업 없이 적용 가능하다. 하지만 LiteSpeed 엔진 계열 같은 경우는 반드시 엔진을 다시 시작해 주어야 변경된 .htaccess가 정상 적용된다.
-
캐시 예외 설정노트@786.210715
index.php?rest_route=/contact-form-7/v1/contact-forms/759/refill
워드프레스 각종 캐시 설정시 Contact Form 7 관련 예외처리 URL
-
the_content() 본문 이미지 추출노트@766.210618
function get_first_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches[1][0]; return $first_img; }
특성 이미지를 사용하지 않을때 목록에서 썸네일로 활용
-
-
Search Meter와 Relevanssi 연동노트@760.210616
function switch_search_meter_priority() { remove_filter( 'the_posts', 'tguy_sm_save_search', 20 ); add_filter( 'the_posts', 'tguy_sm_save_search', 100 ); } add_action( 'init', 'switch_search_meter_priority' );
Search Meter 업데이트 중단으로 보안 이슈 발생하여 코드 폐기
-