WordPress.org

Make WordPress Core

Ticket #10568: wp_upload_dir error.diff

File wp_upload_dir error.diff, 711 bytes (added by simonwheatley, 5 years ago)

Patch to have wp_upload_dir return a WP_Error object on failure to create the dir

  • Users/simon/Projects/SeedsmanAggregator/site/wordpress/wp-includes/functions.php

     
    20702070        // Make sure we have an uploads dir 
    20712071        if ( ! wp_mkdir_p( $uploads['path'] ) ) { 
    20722072                $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] ); 
    2073                 return array( 'error' => $message ); 
     2073                return new WP_Error( 'upload_dir', $message ); 
    20742074        } 
    20752075 
    20762076        return $uploads;