【问题标题】:How to modify the slug for the default WP posts without affecting other posttypes?如何在不影响其他帖子类型的情况下修改默认 WP 帖子的 slug?
【发布时间】:2017-07-23 14:33:44
【问题描述】:

如何在不影响其他帖子类型的情况下修改默认 wp 帖子的 slug?

例如:www.example.com/slug-of-post/ 应该变成 www.example.com/blog/slug-of-post/

我制作了一些自定义帖子类型,在 function.php 文件中使用 'rewrite' => array('slug' => 'portfolio'), 重写了 slug。

结果:www.example.com/post-type-slug/slug-of-post

我需要相同的结果,但对于默认帖子。

谢谢。

【问题讨论】:

  • 将它们添加到子页面?
  • 它们被添加到子页面/blog,但是当转到帖子的详细信息/blog时消失了。
  • 父母:example.com/blog 孩子:example.com/name-of-blog-post
  • 我要做的是:example.com/blog/name-of-blog-post

标签: wordpress permalinks slug


【解决方案1】:

首先,认为listing page slug和detail page parent slug不能相同。 我的意思是,如果您使用 /portfolio slug 创建投资组合页面,并且您想将投资组合 slug 添加为像 /portfolio/post-type-name 这样的详细信息页面,这是不可能的。

对于这种情况,你需要使用/portfolios/portfolio/post-type-name

如果您想为帖子详细信息页面添加自定义 slug,您将使用此插件 Custom Permalinks

【讨论】:

    猜你喜欢
    • 2017-09-19
    • 2014-08-29
    • 1970-01-01
    • 2018-09-24
    • 1970-01-01
    • 1970-01-01
    • 2015-11-30
    • 2021-08-09
    • 2018-06-24
    相关资源
    最近更新 更多