【问题标题】:Wordpress -- permalink with custom post typesWordpress——带有自定义帖子类型的永久链接
【发布时间】:2011-03-30 12:55:22
【问题描述】:

我创建了一个自定义帖子类型,如下所示,

function transactions_register() {

$args = array(

    'label' => __('Transactions'),

    'singular_label' => __('Transaction'),

    'public' => true,

    'show_ui' => true,

    'capability_type' => 'post',

    'hierarchical' => false,

    'rewrite' => array("slug" => "transaction"),

    'supports' => array('title', 'editor', 'thumbnail')

);



register_post_type( 'transaction' , $args );

}

我已将我的永久链接设置为像这样/%category/%postname 但是当我导航到交易时,URL 看起来像这样,

http://www.domian.com/transaction/test

但是这会返回以下服务器错误

找不到页面

我怎样才能使我的自定义帖子类型与我的永久链接设置一起使用?

【问题讨论】:

    标签: wordpress permalinks custom-post-type


    【解决方案1】:

    每当您添加自定义帖子类型时,只需转到设置 -> 固定链接,然后单击“保存”或者是“更新”。它会变魔术。

    【讨论】:

      【解决方案2】:

      每次创建自定义帖子类型或自定义分类时,您都必须转到设置 -> 固定链接并点击保存。它的 wordpress 已知错误。

      【讨论】:

        猜你喜欢
        • 2014-05-17
        • 1970-01-01
        • 2012-02-22
        • 2021-06-10
        • 1970-01-01
        • 1970-01-01
        • 2012-06-10
        • 1970-01-01
        • 2012-05-05
        相关资源
        最近更新 更多