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 리디렉션을 찾을 수 없습니다.
'slug'의 이름을 'slug'=> 'categorys'에서 'slug'=> 'my- 텍스트 '. url http://url.com/my-text에 액세스하여 작동하는지 확인하십시오. –
나는 이것을 시도했지만 모두 헛된 것이었다. 아무 것도 작동하지 않는다. – RamanSall
'products_post_product'를 초기화했지만 메소드 이름은'add_custom_taxonomies'이다. 그래서 그들 중 하나의 이름을 바꿉니다. 나는 이것이 문제일지도 모른다라고 생각한다. –