Title: WP_Filesystem_Base::wp_themes_dir
Published: April 25, 2014
Last modified: August 20, 2026

---

# WP_Filesystem_Base::wp_themes_dir( string|false $theme = false ): string|false

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_filesystem_base/wp_themes_dir/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_filesystem_base/wp_themes_dir/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_filesystem_base/wp_themes_dir/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_filesystem_base/wp_themes_dir/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_filesystem_base/wp_themes_dir/?output_format=md#changelog)

Returns the path on the remote filesystem of the Themes Directory.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_filesystem_base/wp_themes_dir/?output_format=md#parameters)󠁿

 `$theme`string|falseoptional

The theme stylesheet or template for the directory.

Default:`false`

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

 string|false The location of the remote path, or false on failure.

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

    ```php
    public function wp_themes_dir( $theme = false ) {
    	$theme_root = get_theme_root( is_string( $theme ) ? $theme : '' );

    	// Account for relative theme roots.
    	if ( '/themes' === $theme_root || ! is_dir( $theme_root ) ) {
    		$theme_root = WP_CONTENT_DIR . $theme_root;
    	}

    	return $this->find_folder( $theme_root );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-filesystem-base.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/class-wp-filesystem-base.php#L120)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/class-wp-filesystem-base.php#L120-L129)

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

| Uses | Description | 
| [WP_Filesystem_Base::find_folder()](https://developer.wordpress.org/reference/classes/wp_filesystem_base/find_folder/)`wp-admin/includes/class-wp-filesystem-base.php` |

Locates a folder on the remote filesystem.

  | 
| [get_theme_root()](https://developer.wordpress.org/reference/functions/get_theme_root/)`wp-includes/theme.php` |

Retrieves path to themes directory.

  |

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

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

## User Contributed Notes

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