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

Custom Post Type Rewrite To Include Parent Page(s)

programmeradmin3浏览0评论

I have a page title "more" with subpage "cities-guide". Said "cities guide" page has a loop that pulls in posts from custom post type "thailife_city_guide".

My permalink structure is /%category%/%postname%/.

At present clicking a link to a custom post from
www.mydomain/more/cities-guide gives
www.mydomain/thailife_city_guide/bangkok for example.

I want it to be displayed as www.mydomain/more/cities-guide/bangkok but cannot get anything to work

I tried fixing the rewrite in the CPT register to 'rewrite' => array( 'slug' => 'more/cities-guide' ), but to no avail, throws a 404.

Can someone please advise as I just dont really understand the way in which WordPress rewrite works so I am stumped?

I have a page title "more" with subpage "cities-guide". Said "cities guide" page has a loop that pulls in posts from custom post type "thailife_city_guide".

My permalink structure is /%category%/%postname%/.

At present clicking a link to a custom post from
www.mydomain/more/cities-guide gives
www.mydomain/thailife_city_guide/bangkok for example.

I want it to be displayed as www.mydomain/more/cities-guide/bangkok but cannot get anything to work

I tried fixing the rewrite in the CPT register to 'rewrite' => array( 'slug' => 'more/cities-guide' ), but to no avail, throws a 404.

Can someone please advise as I just dont really understand the way in which WordPress rewrite works so I am stumped?

Share Improve this question edited May 15, 2014 at 9:43 kraftner 5,6271 gold badge29 silver badges46 bronze badges asked May 24, 2012 at 12:36 JohnJohn 959 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You may have to flush the permalink structure. You can either visit the settings->permalinks page or use flush_rewrite_rules() method.

发布评论

评论列表(0)

  1. 暂无评论