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

---

# get_parent_theme_file_uri( string $file = ” ): string

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/get_parent_theme_file_uri/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_parent_theme_file_uri/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_parent_theme_file_uri/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_parent_theme_file_uri/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_parent_theme_file_uri/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_parent_theme_file_uri/?output_format=md#changelog)

Retrieves the URL of a file in the parent theme.

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

 `$file`stringoptional

File to return the URL for in the template directory.

Default:`''`

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

 string The URL of the file.

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

    ```php
    function get_parent_theme_file_uri( $file = '' ) {
    	$file = ltrim( $file, '/' );

    	if ( empty( $file ) ) {
    		$url = get_template_directory_uri();
    	} else {
    		$url = get_template_directory_uri() . '/' . $file;
    	}

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

[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#L4679)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/link-template.php#L4679-L4697)

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

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

Filters the URL to a file in the parent theme.

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

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

Retrieves template directory URI 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_uri/?output_format=md#changelog)󠁿

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

## User Contributed Notes

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