【发布时间】:2021-09-26 09:46:02
【问题描述】:
所以,我创建了一个 CPT - Community Post: https://pastebin.com/9XSrvZAr
对于这个 CPT,我创建了两个自定义分类法:https://pastebin.com/fNhfpiM6
community_post_domaincommunity_post_type
我的目标是所有单个社区帖子的永久链接如下:
https://example.com/community/%POST_DOMAIN_SLUG%/%POST_SLUG%
因此,例如,如果我有一个标题为“Go Micro Services”的社区帖子,并将 community_post_domain 设置为名为 Kubernetes 的术语,则永久链接将为:
https://example.com/community/kubernetes/go-micro-services。
这就是我进行永久链接操作的方式: https://pastebin.com/aP5rEBjY
另外,我创建了一个静态页面:Community,其中包含永久链接:https://example.com/community。
到现在为止还挺好。当我尝试发布一个页面并且我希望它具有这样的永久链接时,就会出现问题:https://example.com/community/%PAGE_SLUG%
我创建页面,例如,Hello World。我将父级设置为Community 页面。当我单击Publish 时,页面已创建,在 WordPress 仪表板中,我看到该页面的永久链接符合预期:https://example.com/community/hello-world
但是,这是实际问题 - 当我尝试访问页面的永久链接时,我得到 404。
我尝试在 WP 仪表板中转到 Permalinks 并更新永久链接,但没有帮助。
这里有什么想法吗?
【问题讨论】: