theme_file_path
Filters the path to a file in the theme.
Description
Parameters (2)
- 0. $path (string)
- The file path.
- 1. $file (string)
- The requested file to search for.
Usage
- To run the hook, copy the example below.
- $path = apply_filters( 'theme_file_path', $path, $file );
- if ( !empty( $path ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the theme_file_path callback
- function filter_theme_file_path( $path, $file ) {
- // make filter magic happen here...
- return $path;
- };
- // add the filter
- add_filter( 'theme_file_path', 'filter_theme_file_path', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'theme_file_path', 'filter_theme_file_path', 10, 2 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/link-template.php
- return apply_filters( 'theme_file_path', $path, $file );