WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp mkdir p

Description

Recursive directory creation based on full path.

Will attempt to set permissions on folders.

Usage

<?php wp_mkdir_p$target ?>

Parameters

$target
(string) (required) Full path to attempt to create.
Default: None

Return Values

(boolean) 
Whether the path was created or not. True if path already exists.

Examples

<?php
if ( wp_mkdir_p( '/a/really/deep/sub/directory' ) ) {
    var_dump( file_exists( '/a/really/deep/sub/directory' ) ); // This should be true!
}
?>

Notes

Change Log

Since: 2.0.1

Source File

wp_mkdir_p() is located in wp-includes/functions.php.

Related

See also index of Function Reference and index of Template Tags.