How to add category information to the header in WordPress
목적 1: HTML <head> 영역에 현재 글의 카테고리 이름 삽입 (예: SEO, 메타데이터 용) 방법: functions.php에 코드 추가 php복사편집function add_category_to_head() { if (is_single()) { $categories = get_the_category(); if (!empty($categories)) { echo ‘<meta name=”category” content=”‘ . esc_attr($categories[0]->name) . ‘”>’ . “\n”; } } } add_action(‘wp_head’, ‘add_category_to_head’); 📌 이 코드는 각 글의 <head> 영역에 아래처럼 출력됩니다: html복사편집<meta […]