From f04763c7f1240335c47e50f5e3313fc7c3444495 Mon Sep 17 00:00:00 2001 From: westi Date: Sat, 30 May 2009 10:02:01 +0000 Subject: [PATCH] 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: http://svn.automattic.com/wordpress/trunk@11493 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 9199ab043..7cc9c880c 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1999,15 +1999,15 @@ function wp_upload_dir( $time = null ) { $dir .= $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 - if ( ! wp_mkdir_p( $dir ) ) { - $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir ); + if ( ! wp_mkdir_p( $uploads['path'] ) ) { + $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] ); return array( 'error' => $message ); } - $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ); - - return apply_filters( 'upload_dir', $uploads ); + return $uploads; } /**