get_stylesheet_directory()

Retrieve stylesheet directory path for current theme.


Description Description


Return Return

(string) Path to current theme directory.


Top ↑

Source Source

File: wp-includes/theme.php

function get_stylesheet_directory() {
	$stylesheet = get_stylesheet();
	$theme_root = get_theme_root( $stylesheet );
	$stylesheet_dir = "$theme_root/$stylesheet";

	/**
	 * Filters the stylesheet directory path for current theme.
	 *
	 * @since 1.5.0
	 *
	 * @param string $stylesheet_dir Absolute path to the current theme.
	 * @param string $stylesheet     Directory name of the current theme.
	 * @param string $theme_root     Absolute path to themes directory.
	 */
	return apply_filters( 'stylesheet_directory', $stylesheet_dir, $stylesheet, $theme_root );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content
    Contributed by ma_wordpressorg

    get_stylesheet_directory() retrieves the child-theme’s directory.
    If you want to retrieve the parent-theme’s directory use get_template_directory() instead or even better loacate_template() – This way Wordpress automatically uses your child themes directory to look for your resource – if there is a child-theme-file present it will use this one instead. No need for enqueuing anything.

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