WordPress at a glance

get_parent_theme_file_path() WP 1.0

Retrieves the path of a file in the parent theme.

Works based on: get_template_directory()
✈ 1 time = 0.002969s = very slow | 50000 times = 2.55s = fast PHP 7.1.5, WP 4.9.4
Hooks from function:
Return

String. The path of the file.

Usage

get_parent_theme_file_path( $file );
$file(string)
File to return the path for in the template directory.
Default: ''

Code of get_parent_theme_file_path: wp-includes/link-template.php VER 4.9.8

<?php
function get_parent_theme_file_path( $file = '' ) {
	$file = ltrim( $file, '/' );

	if ( empty( $file ) ) {
		$path = get_template_directory();
	} else {
		$path = get_template_directory() . '/' . $file;
	}

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

Related Functions

From tag: path (directory folder)

More from category: Theme files connection

No comments
    Hello, !     Log In . Register