This page redirects to an external site: https://developer.wordpress.org/reference/functions/wp_normalize_path/
Call the functions to normalize a filesystem path. This function is mainly for windows based server, to replaces backslashes with forward slashes, and ensures no duplicate slashes exist.
<?php wp_normalize_path($path); ?>
A Simple example to normalize the theme include path
$bS_incl_path = get_template_directory() . '/inc';
/**
* Define theme include path
*
* Normalize the include path to be safe on windows hosts
* @return string Normalized path
* require min WordPress version 3.9
* @since boot_Strap 1.0.1
*
*/
if(function_exists('wp_normalize_path')){
$bS_incl_path = wp_normalize_path($bS_incl_path);
}
define('THM_INC', $bS_incl_path);
require_once (THM_INC. '/wp_bootstrap_navwalker.php');
print_r($bS_incl_path); shows
Using this function:
C:/xampp/htdocs/boot_strap/wp-content/themes/boot_Strap/inc
Without this function:
C:\xampp\htdocs\boot_strap/wp-content/themes/boot_Strap/inc
On a Windows server.
Since: 3.9
wp_normalize_path() is located in wp-includes/functions.php.