我有自定义帖子类型“作品”的以下代码,但当前代码不允许在链接上得分“ - ”?我该怎么办?
function works_rewrites_init($post_link, $post = 0){
add_rewrite_rule('works\/([A-Za-z0-9]+)?\/([0-9]+)?(page\/)?([0-9]+)?\/?$', 'index.php?paged=$matches[4]&post_type=works&workscat=$matches[1]&p=$matches[2]', 'top');
}
function works_rewrites_init($post_link, $post = 0){
$rule = 'works\/([A-Za-z0-9\-]+)?\/([0-9]+)?(page\/)?([0-9]+)?\/?$';
$pageID = $post->ID;
add_rewrite_rule($rule, 'index.php?paged=$matches[4]&post_type=works&workscat=$matches[1]&p=$matches[2]', 'top');
}
add_action('init', 'works_rewrites_init');