permalink structure for single-{post-type}.php in wordpress

别等时光非礼了梦想. 提交于 2020-01-05 04:08:10

问题


I have tried many ways to display my custom post type as single-{post-type} and finally it works nicely once i used:

'rewrite'=> false,

before that, i used

'rewrite' => array( 'slug' => 'custom-post-type' )

but never works for me. Don't know where i made mistake. Right now i should feel happy cos its working without any error. But have a small confusion for the permalink because its display:

localhost/myblog/?news=breaking-news instead of: localhost/myblog/news/breaking-news

anyone please provide me some idea how to get link like:

localhost/myblog/news/breaking-news

my permalink structure selected: > http//myblog/sample-post/


回答1:


You had it right the first time...

'rewrite' => array('slug' => 'custom-post-type')

If it's not working then try clearing your rewrite cache by going to Settings > Permalinks and clicking the save button.



来源:https://stackoverflow.com/questions/15050148/permalink-structure-for-single-post-type-php-in-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!