カスタムタクソノミー追加
カスタムタクソノミーの追加方法は、
functions.php
に以下を追加する。
add_action('init', 'create_post_type');
function create_post_type() {
//カスタムタクソノミー(カテゴリタイプ)
register_taxonomy(
'xxxxx_category',
'xxxxx',
array(
'labels' => array(
'name' => __('追加カテゴリー'),
'singular_name' => __('追加カテゴリー')
),
'hierarchical' => true,
'update_count_callback' => '_update_post_term_count',
'public' => true,
'show_ui' => true
)
);
//カスタムタクソノミー(タグタイプ)
register_taxonomy(
'xxxxx_tag',
'xxxxx',
array(
'labels' => array(
'name' => __('追加タグ'),
'singular_name' => __('追加タグ')
),
'hierarchical' => false,
'update_count_callback' => '_update_post_term_count',
'public' => true,
'show_ui' => true
)
);
}
[2015/02/27]