Answering My own question..
这比我想象的要容易。。我用了
post_link
过滤器以以下方式修改永久链接。。
function custom_permalink( $permalink, $post ) {
// Get the categories for the post
$post = get_post( $post_id );
$category = get_the_category( $post_id );
$post_year = mysql2date("Y", $post->post_date);
$target_cat = 6; // Category we\'d like to change permalink for
if ( empty( $post_year ) ) return $permalink;
if ( $category[0]->cat_ID == $target_cat ) {
$permalink = trailingslashit( home_url( $category[0]->slug . \'/\' .$post_year .\'/\' . $post->post_name . \'/\' ) );
}
return $permalink;
}
add_filter( \'post_link\', \'custom_permalink\', 10, 2 );
当然,通过访问设置>永久链接页面来刷新永久链接。