apply_filters( 'upload_dir', array $uploads )
- Since
- 2.0.0
Filters the uploads directory data.
Compatibility
- WordPress
- since 2.0.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$uploadsarray- { Array of information about the upload directory.
@type string $path Base directory and subdirectory or full path to upload directory.
@type string $url Base URL and subdirectory or absolute URL to upload directory.
@type string $subdir Subdirectory if uploads use year/month folders option is on.
@type string $basedir Path without subdir.
@type string $baseurl URL path without subdir.
@type string|false $error False or error message.
}$pathstringBase directory and subdirectory or full path to upload directory.$urlstringBase URL and subdirectory or absolute URL to upload directory.$subdirstringSubdirectory if uploads use year/month folders option is on.$basedirstringPath without subdir.$baseurlstringURL path without subdir.$errorstring|falseFalse or error message.
Where this hook fires · 1
wp-includes/functions.php:2396wp_upload_dir()
Source code
* @type string $subdir Subdirectory if uploads use year/month folders option is on. * @type string $basedir Path without subdir. * @type string $baseurl URL path without subdir. * @type string|false $error False or error message. * } */ $uploads = apply_filters( 'upload_dir', $cache[ $key ] ); if ( $create_dir ) { $path = $uploads['path']; if ( array_key_exists( $path, $tested_paths ) ) { $uploads['error'] = $tested_paths[ $path ];Changelog
Introduced in 2.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.