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

Function Reference/request filesystem credentials


Get filesystem credentials from the user, to be passed to WP_Filesystem.


$creds = request_filesystem_credentials( 
	 "",         // type
	 false,      // error
	 false,      // context
	 null,       // extra_fields
	 false,      // allow_relaxed_file_ownership
if ( false === $creds ) {


(string) (required) The URL that the resulting form should be posted to. Most likely the URL should be created with wp_nonce_url().
Default: None
(string) (optional) The type of method to use for the WP_Filesystem. This is normally determined automatically, and so should remain a blank string. Useful for debugging only.
Default: blank string
(boolean) (optional) false if no error was detected, true if there's an error in initializing the WP_Filesystem class.
Default: false
(string/false) (optional) the directory path to test for filesystem methods in. Or false for the default case
Default: false
(array of strings/null) (optional) An array of form field names to "pass-through" the credentials form. Information in the $_POST array will be used along with this array to build hidden inputs into the POST form, so that the data returns with credentials for later processing. Null if no extra fields are needed.
Default: false

Return values

On success, returns credentials to be passed to the WP_Filesystem class directly. If credentials are needed, a credentials form is output to the user and false is returned.

Further Reading

Source File

request_filesystem_credentials() is located in /wp-admin/includes/file.php.