将其放入插件或functions.php
:
function feed_rewrite( $wp_rewrite ) {
$feed_rules = array(
\'feed/portfolio\' => \'index.php?post_type=post&feed=rss2\'
);
$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
}
// refresh/flush permalinks in the dashboard if this is changed in any way
add_filter( \'generate_rewrite_rules\', \'feed_rewrite\' );
完成后,转到永久链接页面并重新保存以刷新旧规则并重新生成它们
请记住,当更改重写规则以使用monkeyman重写分析器工具插件检查哪些规则用于哪些URL时