Я работаю на сайте, не запрограммированном мной, и не могу решить проблему с пользовательским типом и категорией поста.
URL на сайте должен быть
www.my-site.com/shoes/
www.my-site.com / обувь / мужская обувь /
www.my-site.com / обувь / мужская обувь / сникер /
www.my-site.com / shoes / man-shoes / sniker / name-of-product
Все страницы должны быть доступны с сайта.Но у меня есть эта проблема:
www.my-site.com / shoes / (не работает, стр. 404)
www.my-site.com / shoes / man-shoes/ (работа)
www.my-site.com / обувь / мужская обувь / сникер / (работа)
www.my-site.com / обувь / мужская обувь / сникер/ название продукта (не работает, стр. 404)
Обувь CPT Slug
Обувь мужская - основная категория CPT
Сникер - подкатегория odМужская обувь
Код, используемый для создания настраиваемого типа и категории публикации:
function register_shoes_post_type()
{
register_post_type('shoes', [
'labels' => [
'name' => __('Shoes', PLUGIN_SLUG),
'singular_name' => __('Shoe', PLUGIN_SLUG),
'add_new' => __('Add New', PLUGIN_SLUG),
'add_new_item' => __('Add New Shoes', PLUGIN_SLUG),
'edit_item' => __('Edit Shoes', PLUGIN_SLUG),
'new_item' => __('New Shoes', PLUGIN_SLUG),
'view_item' => __('View Shoes', PLUGIN_SLUG),
'view_items' => __('View Shoes', PLUGIN_SLUG),
'search_items' => __('Search Shoes', PLUGIN_SLUG),
'not_found' => __('No Shoes found.', PLUGIN_SLUG),
'not_found_in_trash' => __('No Shoes found in Trash.', PLUGIN_SLUG),
'parent_item_colon' => __('Parent Shoes:', PLUGIN_SLUG),
'all_items' => __('All Shoes', PLUGIN_SLUG),
'archives' => __('Shoes Archives', PLUGIN_SLUG),
'attributes' => __('Shoes Attributes', PLUGIN_SLUG),
'insert_into_item' => __('Insert into Shoes', PLUGIN_SLUG),
'uploaded_to_this_item' => __('Uploaded to this Shoes', PLUGIN_SLUG),
'featured_image' => __('Shoes picture', PLUGIN_SLUG),
'set_featured_image' => __('Set Shoes picture', PLUGIN_SLUG),
'remove_featured_image' => __('Remove Shoes picture', PLUGIN_SLUG),
'use_featured_image' => __('Use as Shoes picture', PLUGIN_SLUG),
'filter_items_list' => __('Filter Shoes list', PLUGIN_SLUG),
'items_list_navigation' => __('Shoes list navigation', PLUGIN_SLUG),
'items_list' => __('Shoes list', PLUGIN_SLUG)
],
'public' => TRUE,
'has_archive' => false,
'menu_icon' => 'dashicons-products',
'rewrite' => [
'slug' => 'shoes',
'with_front' => FALSE
],
'supports' => [
'title',
'editor',
'thumbnail'
]
]
);
}
Код, используемый для создания категории настраиваемых записей:
function registershoesCategoryTaxonomy()
{
register_taxonomy(
'shoes_category',
'shoes',
[
'labels' => [
'name' => __('Shoes category', PLUGIN_SLUG),
'singular_name' => __('Shoes category', PLUGIN_SLUG),
'menu_name' => __('Shoes category', PLUGIN_SLUG),
'all_items' => __('All Shoes category', PLUGIN_SLUG),
'parent_item' => __('Parent Shoes category', PLUGIN_SLUG),
'parent_item_colon' => __('Parent Shoes category:', PLUGIN_SLUG),
'new_item_name' => __('New Shoes category name', PLUGIN_SLUG),
'add_new_item' => __('Add new Shoes category', PLUGIN_SLUG),
'edit_item' => __('Edit Shoes category', PLUGIN_SLUG),
'update_item' => __('Update Shoes category', PLUGIN_SLUG),
'view_item' => __('View Shoes category', PLUGIN_SLUG),
'separate_items_with_commas' => __('Separate Shoes category with commas', PLUGIN_SLUG),
'add_or_remove_items' => __('Add or remove Shoes category', PLUGIN_SLUG),
'choose_from_most_used' => __('Choose from the most used', PLUGIN_SLUG),
'popular_items' => __('Popular Shoes category', PLUGIN_SLUG),
'search_items' => __('Search Shoes category', PLUGIN_SLUG),
'not_found' => __('Not Found', PLUGIN_SLUG),
'no_terms' => __('No Shoes category', PLUGIN_SLUG),
'items_list' => __('Shoes category list', PLUGIN_SLUG),
'items_list_navigation' => __('Shoes category list navigation', PLUGIN_SLUG)
],
'hierarchical' => TRUE,
'show_admin_column' => TRUE,
'rewrite' => [
'slug' => 'shoes',
'hierarchical' => FALSE,
'with_front' => FALSE
]
]
);
}
I 'Мне не очень хорошо создавать CPT, кто-то может помочь мне разобраться в этом вопросе?
Большое спасибо