Title: get_parent_theme_file_path
Published: December 6, 2016
Last modified: August 20, 2026

---

# get_parent_theme_file_path( string $file = ” ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#user-contributed-notes)

Retrieves the path of a file in the parent theme.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#parameters)󠁿

 `$file`stringoptional

File to return the path for in the template directory.

Default:`''`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#return)󠁿

 string The path of the file.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#source)󠁿

    ```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 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/link-template.php#L4743)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/link-template.php#L4743-L4761)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#hooks)󠁿

 [apply_filters( ‘parent_theme_file_path’, string $path, string $file )](https://developer.wordpress.org/reference/hooks/parent_theme_file_path/)

Filters the path to a file in the parent theme.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#related)󠁿

| Uses | Description | 
| [get_template_directory()](https://developer.wordpress.org/reference/functions/get_template_directory/)`wp-includes/theme.php` |

Retrieves template directory path for the active theme.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/?output_format=md#comment-content-2680)
 2.   [Mahdi Yazdani](https://profiles.wordpress.org/mahdiyazdani/)  [  9 years ago  ](https://developer.wordpress.org/reference/functions/get_parent_theme_file_path/#comment-2680)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_parent_theme_file_path%2F%23comment-2680)
    Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_parent_theme_file_path%2F%23comment-2680)
 4. The proper way to include/require PHP files in `functions.php` or any other.
 5.     ```php
        require get_parent_theme_file_path( '/inc/your-file-name.php' );
        ```
    
 6.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_parent_theme_file_path%2F%3Freplytocom%3D2680%23feedback-editor-2680)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_parent_theme_file_path%2F)
before being able to contribute a note or feedback.