wp_get_upload_dir(): array

Retrieves uploads directory information.

Description

Same as wp_upload_dir() but "light weight" as it doesn’t attempt to create the uploads directory.
Intended for use in themes, when only ‘basedir’ and ‘baseurl’ are needed, generally in all cases when not uploading files.

See also

Return

array See wp_upload_dir() for description.

Source

function wp_get_upload_dir() {
	return wp_upload_dir( null, false );
}

Changelog

VersionDescription
4.5.0Introduced.

User Contributed Notes

  1. Skip to note 2 content
    Anonymous User

    Sample result of the function

    If it is called in index.php:

    array(6) {
    	["path"] => string(61) "server/wp-content/uploads/2019/07"
    	["url"] => string(46) "https://example.com/wp-content/uploads/2019/07"
    	["subdir"] => string(8) "/2019/07"
    	["basedir"] => string(53) "server/wp-content/uploads"
    	["baseurl"] => string(38) "https://example.com/wp-content/uploads"
    	["error"] => bool(false)
    }

You must log in before being able to contribute a note or feedback.