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.

Top ↑

See also


Top ↑

Return

array See wp_upload_dir() for description.


Top ↑

Source

File: wp-includes/functions.php. View all references

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


Top ↑

Changelog

Changelog
Version Description
4.5.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by 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.