更改类别和分类的基名称(不删除)时解决的问题
在函数中。php(如果需要,也可以在插件中)。
您必须输入此代码才能重写此url www.example。组织/英文/[我的位置]/de/[我的类别]
add_action(\'init\', \'flush_rewrite_rules\');
add_filter(\'category_rewrite_rules\' , \'add_rules\' ) ;
function flush_rules() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
function add_rules($rules)
{
/**
* Loop em.
* -------------------------------------------- */
$feed_rule = \'index.php?location=$matches[1]&category_name=$matches[2]&feed=$matches[3]\';
$paged_rule = \'index.php?location=$matches[1]&category_name=$matches[2]&paged=$matches[3]\';
$base_rule = \'index.php?location=$matches[1]&category_name=$matches[2]\';
$rules[\'en/([^/]+)/de/([^/]+)/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$\'] = $feed_rule;
$rules[\'en/([^/]+)/de/([^/]+)/page/?([0-9]{1,})/?$\'] = $paged_rule;
$rules[\'en/([^/]+)/de/([^/]+)/?$\'] = $base_rule;
$feed_rule2 = \'index.php?location=$matches[1]&feed=$matches[2]\';
$paged_rule2 = \'index.php?location=$matches[1]&paged=$matches[2]\';
$base_rule2 = \'index.php?location=$matches[1]\';
$rules[\'en/([^/]+)/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$\'] = $feed_rule2;
$rules[\'en/([^/]+)/page/?([0-9]{1,})/?$\'] = $paged_rule2;
$rules[\'en/([^/]+)/?$\'] = $base_rule2;
return $rules;
}