Answers:
在register_post_type通话中,请确保您具有以下参数:
register_post_type(
'my_post_type',
array(
'hierarchical' => true,
'public' => true,
'rewrite' => array(
'slug' => 'my_post_type',
'with_front' => false,
),
'supports' => array(
'page-attributes' /* This will show the post parent field */,
'title',
'editor',
'something-else',
),
// Other arguments
)
);
确保您的永久链接已清除(只需访问“设置”>“永久链接”页面)。
现在,当您创建一个new时my_post_type,只需将其父级设置为另一个父级,它的永久链接将类似于:
http://example.com/parent-post-type/my-post-type/
您可以根据需要选择多个级别。