Title: WP_Theme::get_stylesheet_directory
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Theme::get_stylesheet_directory(): string

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#wp--skip-link--target)

Returns the absolute path to the directory of a theme’s “stylesheet” files.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#description)󠁿

In the case of a child theme, this is the absolute path to the directory of the 
child theme’s files.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#return)󠁿

 string Absolute path of the stylesheet directory.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#source)󠁿

    ```php
    public function get_stylesheet_directory() {
    	if ( $this->errors() && in_array( 'theme_root_missing', $this->errors()->get_error_codes(), true ) ) {
    		return '';
    	}

    	return $this->theme_root . '/' . $this->stylesheet;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-theme.php#L1156)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-theme.php#L1156-L1162)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Theme::errors()](https://developer.wordpress.org/reference/classes/wp_theme/errors/)`wp-includes/class-wp-theme.php` |

Returns errors property.

  |

| Used by | Description | 
| [WP_Theme::get_block_template_folders()](https://developer.wordpress.org/reference/classes/wp_theme/get_block_template_folders/)`wp-includes/class-wp-theme.php` |

Returns the folder names of the block template directories.

  | 
| [WP_Theme::get_block_patterns()](https://developer.wordpress.org/reference/classes/wp_theme/get_block_patterns/)`wp-includes/class-wp-theme.php` |

Gets block pattern data for a specified theme.

  | 
| [WP_Theme::get_file_path()](https://developer.wordpress.org/reference/classes/wp_theme/get_file_path/)`wp-includes/class-wp-theme.php` |

Retrieves the path of a file in the theme.

  | 
| [WP_Theme::get_screenshot()](https://developer.wordpress.org/reference/classes/wp_theme/get_screenshot/)`wp-includes/class-wp-theme.php` |

Returns the main screenshot file for the theme.

  | 
| [WP_Theme::get_files()](https://developer.wordpress.org/reference/classes/wp_theme/get_files/)`wp-includes/class-wp-theme.php` |

Returns files in the theme’s directory.

  | 
| [WP_Theme::load_textdomain()](https://developer.wordpress.org/reference/classes/wp_theme/load_textdomain/)`wp-includes/class-wp-theme.php` |

Loads the theme’s textdomain.

  | 
| [WP_Theme::__get()](https://developer.wordpress.org/reference/classes/wp_theme/__get/)`wp-includes/class-wp-theme.php` |

__get() magic method for properties formerly returned by [current_theme_info()](https://developer.wordpress.org/reference/functions/current_theme_info/)

  | 
| [WP_Theme::offsetGet()](https://developer.wordpress.org/reference/classes/wp_theme/offsetget/)`wp-includes/class-wp-theme.php` |  |

[Show 3 more](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme/get_stylesheet_directory/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2Fget_stylesheet_directory%2F)
before being able to contribute a note or feedback.