在wordpress函数文件中添加以下代码并进行检查。
add_filter(\'query_vars\', function( $vars ){
$vars[] = \'parent\';
return $vars;
});
function archive_rewrite_rules() {
add_rewrite_rule(
\'^(.*)/(.*)/?$\',
\'index.php?post_type=client&name=$matches[1]&parent=$matches[2]\',
\'top\'
);
add_rewrite_rule(
\'^(.*)/?$\',
\'index.php?post_type=client&name=$matches[1]\',
\'top\'
);
//flush_rewrite_rules(); // use only once
}
add_action( \'init\', \'archive_rewrite_rules\' );