Checks if a file or directory is writable.
Parameters
$pathstringrequired- Path to file or directory.
Source
public function is_writable( $path ) {
return @is_writable( $path );
}
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
Checks if a file or directory is writable.
$pathstringrequiredpublic function is_writable( $path ) {
return @is_writable( $path );
}
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
You have to call function
\WP_Filesystem().if (!\WP_Filesystem()) {
// failed to initialize file system.
return false;
}
global $wp_filesystem;
var_dump($wp_filesystem->is_writable('/path/to/file'));
And if your file is not work in admin pages, require it with
require_once(ABSPATH . 'wp-admin/includes/file.php');.