更改永久链接结构时的问题

时间:2013-04-04 作者:cobcena

我想更改我页面上公文包的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\');

1 个回复
最合适的回答,由SO网友:cobcena 整理而成

我消除了这个错误,是主题本身阻止了公文包表单的更改,编辑了一些来自主题的代码解决了它。该网站是在不再支持的旧主题中创建的:(

结束

相关推荐

Update page breaks permalinks

从3.3.1开始,我有一个奇怪的副作用。当更新页面(或创建新页面)时,我的所有永久链接都会中断-单击相关更新页面上的查看页面将导致404找不到。这不会发生在帖子中。我担心我的permalinks/%postname%/新模式可能会出现问题,但我将其替换为YEAR/postname,没有发现任何差异。我检查并发现帖子名称字段中有一些重复,我更改或删除了任何可疑的重复。仍然没有变化。这是我的htaccess-# BEGIN WordPress <IfModule mod_rewrite.c>