当你register your post type, 将子目录添加到has_archive 参数,并作为slug 的参数rewrite 参数:
$args = array(
// ... other args removed for clarity
\'rewrite\' => array( \'slug\' => \'subdirectory/custom-post-type\' ),
\'has_archive\' => \'subdirectory/custom-post-type\',
// ...
);
register_post_type( \'your_cpt\', $args );