wordpress添加新URL规则

看到wpjam写的
add_action('generate_rewrite_rules', 'wpjam_seo_generate_rewrite_rules');
function wpjam_seo_generate_rewrite_rules($wp_rewrite){

$new_rules = array();

$new_rules[‘sitemap\.xml$’] = ‘index.php?sitemap=1’;

$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}

add_filter(‘query_vars’, ‘wpjam_seo_sitemap_query_vars’);
function wpjam_seo_sitemap_query_vars($public_query_vars) {
$public_query_vars[] = “sitemap”;
return $public_query_vars;
}

作者: anythink

其实没什么好说的

发表评论

电子邮件地址不会被公开。 必填项已用*标注