如何创建一个永久链接结构,该结构通过以下方式完成:
/category-name/post-name/
代替:
/category-slug/post-name/
默认情况下,Wordpress 将%category%标签结构提供为“类别名称的清理版本(新建/编辑类别面板上的类别 slug 字段”。
如何在永久链接中使用类别名称而不是类别 slug?
如何创建一个永久链接结构,该结构通过以下方式完成:
/category-name/post-name/
代替:
/category-slug/post-name/
默认情况下,Wordpress 将%category%标签结构提供为“类别名称的清理版本(新建/编辑类别面板上的类别 slug 字段”。
如何在永久链接中使用类别名称而不是类别 slug?
add_filter('rewrite_rules_array', 'category_name_rewrite_rule');
function category_name_rewrite_rule($rules) {
    $new_rules = array();
    $categories = get_categories();
    foreach ($categories as $category) {
        $cat_name = preg_replace('#\s+#', '-', $category->name);
        $new_rules['/'.$category->slug}.'/'] = '/'.url_encode($cat_name).'/';
    }
    return $new_rules + $rules;
}
    在这里我找到了解决方案 - 而不是Categories,使用Custom_post_types ... 
https://wordpress.stackexchange.com/questions/28979/how-to-change-permalink-structure-for-custom-post-type-and -its-taxonomies/#167992