get_theme_file_path

Advertisement

Summery Summery

Retrieves the path of a file in the theme.

Syntax Syntax

get_theme_file_path( string $file = '' )

Description Description

Searches in the stylesheet directory before the template directory so themes which inherit from a parent theme can just override one file.

Parameters Parameters

$file

(Optional) File to search for in the stylesheet directory.

Default value: ''

Return Return

(string) The path of the file.

Source Source

File: wp-includes/link-template.php

	 * Filters the URL to a file in the parent theme.
	 *
	 * @since 4.7.0
	 *
	 * @param string $url  The file URL.
	 * @param string $file The requested file to search for.
	 */
	return apply_filters( 'parent_theme_file_uri', $url, $file );
}

/**
 * Retrieves the path of a file in the theme.
 *
 * Searches in the stylesheet directory before the template directory so themes
 * which inherit from a parent theme can just override one file.
 *
 * @since 4.7.0
 *
 * @param string $file Optional. File to search for in the stylesheet directory.
 * @return string The path of the file.
 */

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

Advertisement

Leave a Reply