Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

wp_upload_dir()

3 tags 1 category

wp_upload_dir() — Returns an array containing the current upload directory’s path and URL. Checks the ‘upload_path’ option, which should be from the web root folder, and if it isn’t empty it will be used. If it is empty, then the path will be ‘WP_CONTENT_DIR/uploads’. If the ‘UPLOADS’ constant is defined, then it will override the ‘upload_path’ option and ‘WP_CONTENT_DIR/uploads’ path. The upload URL path is set either by the ‘upload_url_path’ option or by using the ‘WP_CONTENT_URL’ constant and appending ‘/uploads’ to the path. If the ‘uploads_use_yearmonth_folders’ is set to true (checkbox if checked in the administration settings panel), then the time will be used.

Inputs: $time (string|null): Optional. Time formatted in ‘yyyy/mm’. Default null. $create_dir (bool): Optional. Whether to check and create the uploads directory. Default true for backward compatibility. $refresh_cache (bool): Optional. Whether to refresh the cache. Default false.

Returns array: Array of information about the upload directory. Field $path (string): Base directory and subdirectory or full path to upload directory. Field $url (string): Base URL and subdirectory or absolute URL to upload directory. Field $subdir (string): Subdirectory if uploads use year/month folders option is on. Field $basedir (string): Path without subdir. Field $baseurl (string): URL path without subdir. Field $error (string|false): False or error message.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…