永久链接结构重写自定义帖子类型和博客

时间:2017-03-05 19:01:46

标签: php wordpress permalinks

我为客户开始了一项工作,以改善他的网站。当我想自定义博客时,我看到自定义固定链接从未在网址中显示“博客”,但它显示%postname%。客户希望出现“博客/年/月/邮政名称”。

CPT中有一个slug,它有一个add_rewrite_rule:

add_rewrite_rule(
        '^cpt/categories/([^/]*)(/page/([0-9]+)?)?/?$',
        'index.php?product_category=$matches[1]&paged=$matches[3]',
        'top'
    );

每当我尝试更改自定义永久链接时,它只会更改cpt的url结构而不会更改其他结构。

我已经尝试过这个建议Custom permalink structure: /%custom-post-type%/%custom-taxonomy%/%post-name%/,但我无法让它发挥作用。你觉得我做错了什么?

0 个答案:

没有答案
相关问题