function get_file_description( $file ) {}

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


  • string $file: Filesystem path or filename

Return values

returns:Description of file from $wp_file_descriptions or basename of $file if description doesn’t exist

Source code

function get_file_description( $file ) {

	global $wp_file_descriptions;

	if ( isset( $wp_file_descriptions[basename( $file )] ) ) {

		return $wp_file_descriptions[basename( $file )];


	elseif ( file_exists( $file ) && is_file( $file ) ) {

		$template_data = implode( '', file( $file ) );

		if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ))

			return sprintf( __( '%s Page Template' ), _cleanup_header_comment($name[1]) );


	return basename( $file );



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: