WP_Filesystem_Base::touch()publicWP 2.5.0

Sets the access and modification times of a file.

Note: If $file doesn't exist, it will be created.

Method of the class: WP_Filesystem_Base{}

No Hooks.


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


$WP_Filesystem_Base = new WP_Filesystem_Base();
$WP_Filesystem_Base->touch( $file, $time, $atime );
$file(string) (required)
Path to file.
Modified time to set for file.
Access time to set for file.


Since 2.5.0 Introduced.

WP_Filesystem_Base::touch() code WP 6.4.1

public function touch( $file, $time = 0, $atime = 0 ) {
	return false;