функция
since 4.7.0
get_parent_theme_file_path()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_parent_theme_file_path( string $file = '' ): string
Описание
Возвращает путь к файлу в родительской теме.
Параметры
$file
string
необязательный
= ''
Файл, для которого нужно вернуть путь, в каталоге шаблона.
Возвращаемое значение
string
Исходный код
wp-includes/link-template.php:4743
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 );
}
История изменений
| Версия | Описание |
|---|---|
| 4.7.0 | Introduced. |

