滤器category_link
所以WordPresscreates 删除类别的URL,以及redirect_canonical
所以它accepts 这些URL:
add_filter( \'category_link\', \'wpse_71666_trailingslash_cat_url\' );
add_filter( \'redirect_canonical\', \'wpse_71666_trailingslash_cat_url\', 20, 2 );
function wpse_71666_trailingslash_cat_url( $url, $request = \'\' )
{
if ( \'category_link\' === current_filter() )
return rtrim( $url, \'/\' ) . \'/\';
if ( "$url/" === $request and is_category() )
return $request;
return $url;
}