template_directory
Filters the active theme directory path.
Usage
add_filter( 'template_directory', 'wp_kama_template_directory_filter', 10, 3 ); /** * Function for `template_directory` filter-hook. * * @param string $template_dir The path of the active theme directory. * @param string $template Directory name of the active theme. * @param string $theme_root Absolute path to the themes directory. * * @return string */ function wp_kama_template_directory_filter( $template_dir, $template, $theme_root ){ // filter... return $template_dir; }
- $template_dir(string)
- The path of the active theme directory.
- $template(string)
- Directory name of the active theme.
- $theme_root(string)
- Absolute path to the themes directory.
Changelog
Since 1.5.0 | Introduced. |
Where the hook is called
template_directory
wp-includes/theme.php 341
return apply_filters( 'template_directory', $template_dir, $template, $theme_root );