admin管理员组文章数量:1122846
I've created a new custom post type with WordPress. However, the slug adds the post to a parent, like so:
However, I'd like it to create:
Is this possible? This is how I've registered the post type:
function create_films() {
register_post_type( 'films',
array(
'labels' => array(
'name' => 'Films' ,
'singular_name' => 'Films'
),
'public' => true,
'has_archive' => false,
'taxonomies' => array('category', 'post_tag')
)
);
}
add_action( 'init', 'create_films' );
And this is the documentation.
I've created a new custom post type with WordPress. However, the slug adds the post to a parent, like so:
http://example.com/UNNCESSARY-PARENT/post-title
However, I'd like it to create:
http://example.com/post-title
Is this possible? This is how I've registered the post type:
function create_films() {
register_post_type( 'films',
array(
'labels' => array(
'name' => 'Films' ,
'singular_name' => 'Films'
),
'public' => true,
'has_archive' => false,
'taxonomies' => array('category', 'post_tag')
)
);
}
add_action( 'init', 'create_films' );
And this is the documentation.
Share Improve this question asked Dec 11, 2013 at 16:37 tmyietmyie 8732 gold badges13 silver badges21 bronze badges 3 |1 Answer
Reset to default 0I've been using Custom Permalinks plugin for a while and works ok.
本文标签: Remove parent from custom post type
版权声明:本文标题:Remove parent from custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736287387a1927868.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
rewrite => array('with_front' => false);
Read More About CPT Rewrites – Howdy_McGee ♦ Commented Dec 11, 2013 at 16:38'rewrite'=> array( 'with_front' => false )
but it's still appearing. I've also refreshed the permalinks settings. – tmyie Commented Dec 11, 2013 at 16:45