[wp-trac] [WordPress Trac] #14840: Constant UPLOADS not working for the main site if MULTISITES is not enabled

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 10 20:04:15 UTC 2010

#14840: Constant UPLOADS not working for the main site if MULTISITES is not enabled
 Reporter:  Axel_germany  |       Owner:                                           
     Type:  defect (bug)  |      Status:  new                                      
 Priority:  normal        |   Milestone:  Awaiting Review                          
Component:  General       |     Version:  3.1                                      
 Severity:  normal        |    Keywords:  CONSTANT UPLOADS, no Multisite, main blog
 You can enable Multisite support by defining the constant
 "MULTISITE“ within wp-config.php. Thus if you don't have multisite support
 enabled the Constant isn't set and defined(constant("MULTISITE“)) returns
 false. However on line 89 of the file wp-settings.php the constant
 "MULTISITE“ is defined and set to „false“ if your wp is not a multisite

 // Initialize multisite if enabled.
 if ( is_multisite() ) {
         require( ABSPATH . WPINC . '/ms-blogs.php' );
         require( ABSPATH . WPINC . '/ms-settings.php' );
 } elseif ( ! defined( 'MULTISITE' ) ) {
         define( 'MULTISITE', false );

 Due to this the overwriting of the upload path which is possible by
 defining the constant "UPLOADS“ doesn't work for the main site because the
 if clause in in line 2146 of wp-includes/functions.php

 if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) ||
 $switched === false ) ) {
                 $dir = ABSPATH . UPLOADS;
                 $url = trailingslashit( $siteurl ) . UPLOADS;

  isn't true even if the CONSTANT 'UPLOADS' is defined because
 $main_override is true and thus !$main_override is false. $main_override
 is true because line 2127 of the same file is in this case true.

 $main_override = defined( 'MULTISITE' ) && is_main_site();

 From my point of view it would be better to use

 $main_override = constant( 'MULTISITE' )== true && is_main_site();


 used Version: a development version (3.1-alpha) (SVN TRUNK Sept. 10 2010)

Ticket URL: <http://core.trac.wordpress.org/ticket/14840>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list