get_stylesheet()
Retrieve the name of the current theme directory.
This function retrieves the data with get_option('stylesheet')
.
The advantage of this function is that it passes the data through the stylesheet filter that plugins can use.
Uses: get_option()
1 time — 0.0032818 sec (very slow) | 50000 times — 3.20 sec (fast) | PHP 7.3.20, WP 5.6
Hooks from the function
Return
String
. Stylesheet name.
Usage
get_stylesheet();
Examples
#1 Output the name (folder name) of the current theme
Suppose we are using "twentytwelve" theme, let's output it's folder name:
echo get_stylesheet(); // output: twentytwelve
Changelog
Since 1.5.0 | Introduced. |
get_stylesheet() get stylesheet code WP 6.7.1
function get_stylesheet() { /** * Filters the name of current stylesheet. * * @since 1.5.0 * * @param string $stylesheet Name of the current stylesheet. */ return apply_filters( 'stylesheet', get_option( 'stylesheet' ) ); }