Filter hook 'template'

in WP Core File wp-includes/theme.php at line 325

View Source

template

Filter Hook
Description
Filters the name of the active theme.

Hook Information

File Location wp-includes/theme.php View on GitHub
Hook Type Filter
Line Number 325

Hook Parameters

Type Name Description
string $template active theme's directory name.

Usage Examples

Basic Usage
<?php
// Hook into template
add_filter('template', 'my_custom_filter', 10, 1);

function my_custom_filter($template) {
    // Your custom filtering logic here
    return $template;
}

Source Code Context

wp-includes/theme.php:325 - How this hook is used in WordPress core
<?php
 320  	 *
 321  	 * @since 1.5.0
 322  	 *
 323  	 * @param string $template active theme's directory name.
 324  	 */
 325  	return apply_filters( 'template', get_option( 'template' ) );
 326  }
 327  
 328  /**
 329   * Retrieves template directory path for the active theme.
 330   *

PHP Documentation

<?php
/**
	 * Filters the name of the active theme.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template active theme's directory name.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/theme.php
Related Hooks

Related hooks will be displayed here in future updates.