wp_basename( string   $path , string   $suffix = '' ): string

i18n-friendly versionen of basename().

Parameters

$path string required
A path.
$suffix string optional
If the filename ends in suffix this will also be cut off.

Default: ''

Return

string

Source

function wp_basename( $path, $suffix = '' ) {
	return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
}

Changuelog

Versionen Description
3.1.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.