我有三种自定义帖子类型、一种自定义分类法和一些页面。自定义分类法是使用post类型之一注册的。问题是,当默认的Permalink为enable时,它适用于所有页面、自定义帖子类型和分类。但当“Post name”或任何其他permalink启用时,它会破坏页面结构,其余链接工作正常。
注册post类型和分类后,我使用flush\\u rewrite\\u rules(),但它不起作用。
在这种情况下请帮助我。
add_action("after_setup_theme","rg_menus");
function rg_menus(){
register_nav_menus(array(
\'header\'=> "Primary Menu",
\'footer\'=> "Footer Menu",
\'header_menu\'=>\'Top Menu\'
));
add_theme_support("post-thumbnails");
add_image_size("home_header",1517,516,true);
add_image_size("page_headers",1517,259,true);
create_product();
create_product_category();
}
/*===============================*/
/* P-Riopel Product */
function create_product(){
register_post_type(\'priopel_products\', array( \'label\' => \'PRiopel Products\',\'description\' => \'\',\'public\' => true,\'show_ui\' => true,\'show_in_menu\' => true,\'capability_type\' => \'post\',\'hierarchical\' => false,\'rewrite\' => array(\'slug\' => \'product\'),\'query_var\' => true,\'has_archive\' => true,\'exclude_from_search\' => false,\'supports\' => array(\'title\',\'editor\',\'excerpt\',\'trackbacks\',\'custom-fields\',\'thumbnail\',\'author\',\'page-attributes\',),\'taxonomies\' => array(\'priopel_cat\',),\'labels\' => array (
\'name\' => \'PRiopel Products\',
\'singular_name\' => \'PRiopel Product\',
\'menu_name\' => \'PRiopel Products\',
\'add_new\' => \'Add Product\',
\'add_new_item\' => \'Add New Product\',
\'edit\' => \'Edit\',
\'edit_item\' => \'Edit Product\',
\'new_item\' => \'New Product\',
\'view\' => \'View Product\',
\'view_item\' => \'View Product\',
\'search_items\' => \'Search Products\',
\'not_found\' => \'No Products Found\',
\'not_found_in_trash\' => \'No Products Found in Trash\',
\'parent\' => \'Parent Product\',
),) );
}
/*===============================*/
/* P-Riopel Product Category */
function create_product_category(){
register_taxonomy(\'priopel_cat\',
array (\'priopel_products\',
),array( \'hierarchical\' => true,
\'public\' => true,
\'label\' => \'Categories\',
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => array(\'slug\' => \'\',\'with_front\' => true,\'hierarchical\'=>true),
\'singular_label\' => \'Category\') );
}