WordPress.org

Codex

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

Function Reference/wp is writable

Description

Determine if a path is writable. This is a wrapper function that detects if you're using Microsoft Windows, and uses the correct function for your OS.

Parameters

$path
(string) (required) the path to the file or directory that you want to use.
Default: None

Return

(boolean) 
returns true if writable. Otherwise, if the file or directory located at $path either does not exist or is not writable, returns false.

Usage

 <?php $is_writable wp_is_writable($path); ?> 

Example

Can be used in your theme or plugin.

$path = WP_CONTENT . '/uploads';

if (wp_is_writable($path)){
    // upload your file to here
}

Change Log

Source File

wp_is_writable is located in wp-includes/functions.php.

Related

This article is marked as in need of editing. You can help Codex by editing it.