2014-06-05 3 views
0

"인센티브"라는 맞춤형 게시물 유형을 만들려고합니다. 이 맞춤형 게시물 유형 내에서 "조명 인센티브"라는 카테고리를 만들고 싶습니다. 사용자 정의 게시 유형을 등록하고 분류/카테고리를 작성하는 함수를 작성했습니다. 그러나 어떤 이유로 인해 택 소노 미/카테고리를 등록 할 수 없습니다. 분류 대/카테고리가 WP 대시 보드에 나타나지 않습니다. 또한 "인센티브"와 "조명 인센티브"의 계층 구조가 약간 엇갈린 것처럼 보입니다. 여기 내 코드는WP 맞춤형 게시물 유형 분류 - 카테고리를 생성해야합니다.

add_action('init', 'incentive_register'); 

function incentive_register() { 

    $labels = array(
     'name' => _x('Lighting Incentives', 'post type general name'), 
     'singular_name' => _x('Lighting Incentive', 'post type singular name'), 
     'add_new' => _x('Add New', 'Lighting Incentive'), 
     'add_new_item' => __('Add New Lighting Incentive'), 
     'edit_item' => __('Edit Lighting Incentive'), 
     'new_item' => __('New Lighting Incentive'), 
     'view_item' => __('View Incentive'), 
     'search_items' => __('Search Incentives'), 
     'not_found' => __('Nothing found'), 
     'not_found_in_trash' => __('Nothing found in Trash'), 
     'parent_item_colon' => '' 
    ); 

    $args = array(
     'labels' => $labels, 
     'public' => true, 
     'publicly_queryable' => true, 
     'show_ui' => true, 
     'query_var' => true, 
     'menu_icon' => get_stylesheet_directory_uri() . '/article16.png', 
     'rewrite' => true, 
     'capability_type' => 'post', 
     'has_archive' => 'lighting-incentives', 
     'menu_position' => null, 
     'parent_item' => 'Incentives', 
     'supports' => array('title','editor','thumbnail','excerpt','custom-fields','post-formats') 
    ); 

    register_post_type('Incentive' , $args); 
    register_taxonomy_for_object_type('category','Incentive'); 

     flush_rewrite_rules(); 
} 

답변

2

사용자 정의 포스트 유형의 이름은 소문자 여야합니다. 이

register_post_type('Incentive' , $args); 
register_taxonomy_for_object_type('category','Incentive'); 

당신은 당신의 영구 링크를 플러시한다

register_post_type('incentive' , $args); 
register_taxonomy_for_object_type('category','incentive'); 

EDIT로 변경에만

관련 문제