跳转到主要内容

WP_CLI\Utils\make_temp_dir()

Create a unique temporary directory safely without following symlinks.


Usage

WP_CLI\Utils\make_temp_dir( $prefix = wp-cli- )
$prefix (string) Optional. Prefix for the temporary directory name. Default 'wp-cli-'.
@return (string) to the created temporary directory with a trailing slash.

Notes

The directory is only accessible by its owner on non-Windows systems.

The directory is created in the directory returned by WP-CLI's get_temp_dir() (based on sys_get_temp_dir()), not WordPress's get_temp_dir(), and is not removed automatically; callers are responsible for cleaning it up.

On failure, this function exits via WP_CLI::error() rather than throwing.

Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.