template_directory
Filter HookDescription
Filters the active theme directory path.Hook Information
File Location |
wp-includes/theme.php
View on GitHub
|
Hook Type | Filter |
Line Number | 351 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$template_dir
|
The path of the active theme directory. |
string
|
$template
|
Directory name of the active theme. |
string
|
$theme_root
|
Absolute path to the themes directory. |
Usage Examples
Basic Usage
<?php
// Hook into template_directory
add_filter('template_directory', 'my_custom_filter', 10, 3);
function my_custom_filter($template_dir, $template, $theme_root) {
// Your custom filtering logic here
return $template_dir;
}
Source Code Context
wp-includes/theme.php:351
- How this hook is used in WordPress core
<?php
346 *
347 * @param string $template_dir The path of the active theme directory.
348 * @param string $template Directory name of the active theme.
349 * @param string $theme_root Absolute path to the themes directory.
350 */
351 return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
352 }
353
354 /**
355 * Retrieves template directory URI for the active theme.
356 *
PHP Documentation
<?php
/**
* Filters the active theme directory path.
*
* @since 1.5.0
*
* @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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/theme.php
Related Hooks
Related hooks will be displayed here in future updates.