2016-09-01 1 views
0
add_action('init', 'products_post_product'); 

function add_custom_taxonomies() { 
    // Add new "Locations" taxonomy to Posts 
    register_taxonomy('Categorys', 'products', array(
    // Hierarchical taxonomy (like categories) 
    'hierarchical' => true, 

    'show_ui'   => true, 
    'show_admin_column' => true, 
    'query_var'   => false, 

// 'hide_meta_box' => true, 
    // This array of options controls the labels displayed in the WordPress Admin UI 
    'labels' => array(
     'name' => _x('categorys', 'taxonomy general name'), 
     'singular_name' => _x('Categorys', 'taxonomy singular name'), 
     'search_items' => __('Search Categorys'), 
     'all_items' => __('All Categorys'), 
     'parent_item' => __('Parent Categorys'), 
     'parent_item_colon' => __('Parent Categorys:'), 
     'edit_item' => __('Edit Categorys'), 
     'update_item' => __('Update Categorys'), 
     'add_new_item' => __('Add New Categorys'), 
     'new_item_name' => __('New Categorys Name'), 
     'menu_name' => __('Categorys'), 
    ), 
    // Control the slugs used for this taxonomy 
    'rewrite' => array(
     'slug' => 'categorys', // This controls the base slug that will display before each term 
    // 'with_front' => true, // Don't display the category base before "/locations/" 
    // 'hierarchical' => false // This will allow URL's like "/locations/boston/cambridge/" 
    ), 
) 
); 

} 

위 코드는 다음과 같습니다. 그러나 분류학 용어 페이지가 페이지를 찾을 수 없음 페이지로 리디렉션 중입니다. 내 url hhtp : //url.com/categorys- 404 페이지. 실수로 코드를 작성했거나 페이지를 다른 페이지로 리디렉션해야하거나 내 분류 체계 슬러그를 다른 페이지로 만들어야합니다. 도움 말페이지에서 사용자 지정 texonomy 리디렉션을 찾을 수 없습니다.

+0

'slug'의 이름을 'slug'=> 'categorys'에서 'slug'=> 'my- 텍스트 '. url http://url.com/my-text에 액세스하여 작동하는지 확인하십시오. –

+0

나는 이것을 시도했지만 모두 헛된 것이었다. 아무 것도 작동하지 않는다. – RamanSall

+0

'products_post_product'를 초기화했지만 메소드 이름은'add_custom_taxonomies'이다. 그래서 그들 중 하나의 이름을 바꿉니다. 나는 이것이 문제일지도 모른다라고 생각한다. –

답변

1

위 코드는 다음과 같습니다. 그러나 분류학 용어 페이지가 페이지를 찾을 수 없음 페이지로 리디렉션 중입니다. 내 url hhtp : //url.com/categorys- 404 페이지. 코드에서 실수를하거나 페이지를 다른 페이지로 리디렉션해야하거나 내 분류 체계 슬러그를 다른 페이지로 만들어야합니다. 도움 말

답변 : 분류법에 필요한 파일을 만드는 데 필요합니다. taxonomy-categorys.php 분류법 이름 앞에 분류법 단어

+0

해당 파일을 만들었지 만 그 파일은 hhtp : //url.com/categorys/post1에서 실행됩니다. taxonomy term-hhtp : //url.com/categorys에서 실행되지 않습니다. – RamanSall

+0

add_action ('init', 'products_post_product') ; add_custom_taxonomies 함수() { ...}는 는 ('init를'add_custom_taxonomies ')를 ADD_ACTION 아래와 같은 기능 이름과 같은 동작을 변경해주십시오; function add_custom_taxonomies() { ... } –

관련 문제