WP_Filesystem_Base::wp_themes_dir() WordPress Method

The wp_themes_dir method is a part of the WP_Filesystem_Base class and is used to retrieve the path to the themes directory. This is useful for creating or accessing files within the themes directory.

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

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


Parameters

$theme

(string|false)(Optional) The theme stylesheet or template for the directory.

Default value: false


Top ↑

Return

(string) The location of the remote path.


Top ↑

Source

File: wp-admin/includes/class-wp-filesystem-base.php

	public function wp_themes_dir( $theme = false ) {
		$theme_root = get_theme_root( $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 );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.