我想更改我页面上公文包的slug,它实际上是/公文包项目/我去了我的custom_post_types.php
文件,并根据需要更改了slug的重写规则,但当我刷新永久链接结构时,我的所有投资组合项目的永久链接都会更改为mysite.es/myslug//
. 我做错什么了吗?更改permalink结构时还需要其他什么吗?
// Register Custom Post Type: \'Portfolio\'
function ss_framework_register_post_type_portfolio() {
$labels = array(
\'name\' => __( \'Portfolio\', \'ss_framework\' ),
\'singular_name\' => __( \'Project\', \'ss_framework\' ),
\'add_new\' => __( \'Add New\', \'ss_framework\' ),
\'add_new_item\' => __( \'Add New Project\', \'ss_framework\' ),
\'edit_item\' => __( \'Edit Project\', \'ss_framework\' ),
\'new_item\' => __( \'New Project\', \'ss_framework\' ),
\'view_item\' => __( \'View Project\', \'ss_framework\' ),
\'search_items\' => __( \'Search Projects\', \'ss_framework\' ),
\'not_found\' => __( \'No projects found\', \'ss_framework\' ),
\'not_found_in_trash\' => __( \'No projects found in Trash\', \'ss_framework\' ),
\'parent_item_colon\' => __( \'Parent Project:\', \'ss_framework\' ),
\'menu_name\' => __( \'Portfolio\', \'ss_framework\' ),
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => false,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\' ),
\'taxonomies\' => array( \'portfolio-categories\' ),
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'show_in_nav_menus\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => true,
\'has_archive\' => true,
\'query_var\' => true,
\'can_export\' => true,
\'rewrite\' => array( \'slug\' => \'portfolio-item\' ),
\'capability_type\' => \'post\',
\'menu_position\' => null,
\'menu_icon\' => SS_BASE_URL . \'functions/assets/img/icon-portfolio.png\'
);
register_post_type( \'portfolio\', apply_filters( \'ss_framework_register_post_type_portfolio\', $args ) );
}add_action(\'init\', \'ss_framework_register_post_type_portfolio\');