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

Function Reference/download url


Downloads a url to a local temporary file using the WordPress HTTP Class. Please note that the calling function must unlink() the file.


(string) (required) the URL of the file to download
Default: None
(integer) (optional) The timeout for the request to download the file default 300 seconds
Default: 300

Return Values

WP_Error on failure, string Filename on success.

Change Log

Since: 2.5

Source File

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