Title: WP_CLI\Utils\get_temp_dir()
Published: June 12, 2025
Last modified: April 20, 2026

---

# WP_CLI\Utils\get_temp_dir()

## In this article

 * [Usage](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-utils-get-temp-dir/?output_format=md#usage)
 * [Related](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-utils-get-temp-dir/?output_format=md#related)

[↑ Back to top](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-utils-get-temp-dir/?output_format=md#wp--skip-link--target)

Get the system’s temp directory. Warns user if it isn’t writable.

---

## 󠀁[Usage](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-utils-get-temp-dir/?output_format=md#usage)󠁿

    ```
    WP_CLI\Utils\get_temp_dir()
    ```

 **@return** (string)

_Internal APIAPI An API or Application Programming Interface is a software intermediary
that allows programs to interact with each other and share data in limited, clearly
defined ways. documentation is generated from the WP-CLIWP-CLI WP-CLI is the Command
Line Interface for WordPress, used to do administrative and development tasks in
a programmatic way. The project page is [http://wp-cli.org/](http://wp-cli.org/)
[https://make.wordpress.org/cli/](https://make.wordpress.org/cli/) codebase on every
release. To suggest improvements, please submit a pull request._

---

## 󠀁[Related](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-utils-get-temp-dir/?output_format=md#related)󠁿

 * **[WP_CLI\Utils\get_home_dir()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-get-home-dir/)**–
   Get the home directory.
 * **[WP_CLI\Utils\trailingslashit()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-trailingslashit/)**–
   Appends a trailing slash.
 * **[WP_CLI\Utils\normalize_path()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-normalize-path/)**–
   Normalize a filesystem path.
 * **[WP_CLI\Utils\get_php_binary()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-utils-get-php-binary/)**–
   Get the path to the PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor)
   is a widely-used open source general-purpose scripting language that is especially
   suited for web development and can be embedded into HTML. [https://www.php.net/manual/en/preface.php](https://www.php.net/manual/en/preface.php)
   binary used when executing WP-CLI.
 * **[WP_CLI::get_php_binary()](https://make.wordpress.org/cli/handbook/internal-api/wp-cli-get-php-binary/)**–
   Get the path to the PHP binary used when executing WP-CLI.

First published

June 12, 2025

Last updated

April 20, 2026

Edit article

[ Improve it on GitHub: [article_title] ](https://github.com/wp-cli/handbook/edit/main/internal-api/wp-cli-utils-get-temp-dir.md)

Changelog

[ See list of changes: [article_title] ](https://github.com/wp-cli/handbook/commits/main/internal-api/wp-cli-utils-get-temp-dir.md)

[  Previous: WP_CLI\Utils\get_php_binary()](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-utils-get-php-binary/)

[  Next: WP_CLI\Utils\http_request()](https://make.wordpress.org/cli/handbook/references/internal-api/wp-cli-utils-http-request/)