upload_dir
Filters the uploads directory data.
Description
Parameters (1)
- 0. $cache_key (array)
- Array of upload directory data with keys of path,, url, subdir, .basedir', and
error
.
Usage
- To run the hook, copy the example below.
- $cache_key = apply_filters( 'upload_dir', $cache_key );
- if ( !empty( $cache_key ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the upload_dir callback
- function filter_upload_dir( $cache_key ) {
- // make filter magic happen here...
- return $cache_key;
- };
- // add the filter
- add_filter( 'upload_dir', 'filter_upload_dir', 10, 1 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'upload_dir', 'filter_upload_dir', 10, 1 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/functions.php
- $uploads = apply_filters( 'upload_dir', $cache[ $key ] );