WordPress
2
Вклад в тег
function pcl_smart_trailingslashit($string) {
/* ensure, that there is one trailing slash */
$string = rtrim($string, '/') . '/';
/* if there is a filename extension like .html or .php, then remove the trailing slash */
if ( 0 < preg_match("#\.[^/]+/$#", $string) ) {
$string = rtrim($string, '/');
}
return $string;
}
add_filter('user_trailingslashit', 'pcl_smart_trailingslashit');