get_template()

Retrieves name of the current theme.


Return Return

(string) Template name.


Top ↑

More Information More Information

This function retrieves the directory name of the current theme, without the trailing slash. In the case a child theme is being used, the directory name of the parent theme will be returned. Use get_stylesheet() to get the directory name of the child theme.


Top ↑

Source Source

File: wp-includes/theme.php

function get_template() {
	/**
	 * Filters the name of the current theme.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template Current theme's directory name.
	 */
	return apply_filters( 'template', get_option( 'template' ) );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 2 content
    Contributed by Will Skora

    Note that get_template will return the parent theme’s name, NOT the child theme’s name, if a child theme is currently activated.

    If you wish to obtain the current theme regardless if it is a child theme or the parent theme, use get_stylesheet

    (reference question on wordpress stack exchange)

You must log in before being able to contribute a note or feedback.