WordPress at a glance
function is not described

get_file_description() WP 1.5.0

Get the description for standard WordPress theme files and other various standard WordPress files

  • Global. Array. $wp_file_descriptions Theme file descriptions.
  • Global. Array. $allowed_files List of allowed files.

No Hooks.

Return

String. Description of file from $wp_file_descriptions or basename of $file if description doesn't exist. Appends 'Page Template' to basename of $file if the file is a page template

Usage

get_file_description( $file );
$file(string) (required)
Filesystem path or filename

Code of get file description: wp-admin/includes/file.php VER 5.1.1

<?php
function get_file_description( $file ) {
	global $wp_file_descriptions, $allowed_files;

	$dirname = pathinfo( $file, PATHINFO_DIRNAME );

	$file_path = $allowed_files[ $file ];
	if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $dirname ) {
		return $wp_file_descriptions[ basename( $file ) ];
	} elseif ( file_exists( $file_path ) && is_file( $file_path ) ) {
		$template_data = implode( '', file( $file_path ) );
		if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
			return sprintf( __( '%s Page Template' ), _cleanup_header_comment( $name[1] ) );
		}
	}

	return trim( basename( $file ) );
}