Move - Dir - Function - WordPress Developer Resources

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

06/08/23, 00:10 move_dir() | Function | WordPress Developer Resources

move_dir() | Function |
WordPress Developer Resources
Moves a directory from one location to another.

Recursively invalidates OPcache on success.

If the renaming failed, falls back to copy_dir() .

Assumes that WP_Filesystem() has already been called and setup.

This function is not designed to merge directories, copy_dir() should be used


instead.

$fromstringRequired
Source directory.

$tostringRequired
Destination directory.

$overwriteboolOptional
Whether to overwrite the destination directory if it exists.

Default: false

true|WP_Error True on success, WP_Error on failure.

https://developer.wordpress.org/reference/functions/move_dir/ 1/2
06/08/23, 00:10 move_dir() | Function | WordPress Developer Resources

File: wp-admin/includes/file.php. View all references

function move_dir( $from, $to, $overwrite = false ) {global $wp_filesystem;if ( trailingslashit( strto

View on TracView on GitHub

Changelog
Version Description
6.2.0 Introduced.

https://developer.wordpress.org/reference/functions/move_dir/ 2/2

You might also like