WP_Filesystem_FTPext::mkdir()publicWP 2.5.0

Creates a directory.

Method of the class: WP_Filesystem_FTPext{}

No Hooks.


true|false. True on success, false on failure.


$WP_Filesystem_FTPext = new WP_Filesystem_FTPext();
$WP_Filesystem_FTPext->mkdir( $path, $chmod, $chown, $chgrp );
$path(string) (required)
Path for new directory.
The permissions as octal number (or false to skip chmod).
Default: false
A user name or number (or false to skip chown).
Default: false
A group name or number (or false to skip chgrp).
Default: false


Since 2.5.0 Introduced.

WP_Filesystem_FTPext::mkdir() code WP 6.5.4

public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
	$path = untrailingslashit( $path );

	if ( empty( $path ) ) {
		return false;

	if ( ! ftp_mkdir( $this->link, $path ) ) {
		return false;

	$this->chmod( $path, $chmod );

	return true;