Move the upload_dir filter before the directory is created so that plugins can have a better effect. Fixes #9973 props dd32.
git-svn-id: https://develop.svn.wordpress.org/trunk@11493 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6e481f5d1e
commit
3982e62858
|
@ -1999,15 +1999,15 @@ function wp_upload_dir( $time = null ) {
|
||||||
$dir .= $subdir;
|
$dir .= $subdir;
|
||||||
$url .= $subdir;
|
$url .= $subdir;
|
||||||
|
|
||||||
|
$uploads = apply_filters( 'upload_dir', array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ) );
|
||||||
|
|
||||||
// Make sure we have an uploads dir
|
// Make sure we have an uploads dir
|
||||||
if ( ! wp_mkdir_p( $dir ) ) {
|
if ( ! wp_mkdir_p( $uploads['path'] ) ) {
|
||||||
$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
|
$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] );
|
||||||
return array( 'error' => $message );
|
return array( 'error' => $message );
|
||||||
}
|
}
|
||||||
|
|
||||||
$uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
|
return $uploads;
|
||||||
|
|
||||||
return apply_filters( 'upload_dir', $uploads );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue