问题
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