wp_basename

The timeline below displays how wordpress function wp_basename has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * i18n-friendly version of basename().
 *
 * @since 3.1.0
 *
 * @param string $path   A path.
 * @param string $suffix If the filename ends in suffix this will also be cut off.
 * @return string
 */
function wp_basename($path, $suffix = '')
{
    return urldecode(basename(str_replace(array('%2F', '%5C'), '/', urlencode($path)), $suffix));
}

WordPress Version: 4.3

/**
 * i18n friendly version of basename()
 *
 * @since 3.1.0
 *
 * @param string $path   A path.
 * @param string $suffix If the filename ends in suffix this will also be cut off.
 * @return string
 */
function wp_basename($path, $suffix = '')
{
    return urldecode(basename(str_replace(array('%2F', '%5C'), '/', urlencode($path)), $suffix));
}

WordPress Version: 3.7

/**
 * i18n friendly version of basename()
 *
 * @since 3.1.0
 *
 * @param string $path A path.
 * @param string $suffix If the filename ends in suffix this will also be cut off.
 * @return string
 */
function wp_basename($path, $suffix = '')
{
    return urldecode(basename(str_replace(array('%2F', '%5C'), '/', urlencode($path)), $suffix));
}