我找到了这个方便的解决方案without plugin.
https://stackoverflow.com/a/27569173/851045
function fix_slash( $string, $type ) {
global $wp_rewrite;
if ( $wp_rewrite->use_trailing_slashes == false ) {
if ( $type != \'single\' && $type != \'category\' )
return trailingslashit( $string );
if ( $type == \'single\' && ( strpos( $string, \'.html/\' ) !== false ) )
return trailingslashit( $string );
if ( $type == \'category\' && ( strpos( $string, \'category\' ) !== false ) ){
$aa_g = str_replace( "/category/", "/", $string );
return trailingslashit( $aa_g );
}
if ( $type == \'category\' )
return trailingslashit( $string );
}
return $string;
}
add_filter( \'user_trailingslashit\', \'fix_slash\', 55, 2 );