最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

url rewriting - Custom post type archive with page as parent url

programmeradmin1浏览0评论

I have a custom post type called articoli-redazione. I would like to make archive url of this kind of post type to have a PAGE as parent as in this example:

The custom post type needs to be hierarchical.

Is that possible? Is there a way to have a custom rewrite?

Thank you!

I have a custom post type called articoli-redazione. I would like to make archive url of this kind of post type to have a PAGE as parent as in this example:

https://mywebsite.it/page-name/custom-post-type-archive

The custom post type needs to be hierarchical.

Is that possible? Is there a way to have a custom rewrite?

Thank you!

Share Improve this question asked Jul 18, 2019 at 12:35 StefanoStefano 1391 gold badge3 silver badges13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

Yes. First, unregister the post type. (None of the actual data will be deleted if you already have posts.) Then, re-register it with

'rewrite' => array('slug' => 'page-name/custom-post-type-archive')

This will set your archive at the URL you're looking for, and all the individual CPT posts will be "under" that - i.e. '/page-name/custom-post-type-archive/single-title/'.

发布评论

评论列表(0)

  1. 暂无评论