Make WordPress Core

Opened 8 years ago

Last modified 8 years ago

#14840 closed defect (bug)

Constant UPLOADS not working for the main site if MULTISITES is not enabled — at Initial Version

Reported by: Axel_germany Owned by:
Milestone: 3.0.2 Priority: high
Severity: major Version: 3.1
Component: Upload Keywords:
Focuses: Cc:


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 wp.

<code> 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 );

} </code>

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.

<code> $main_override = defined( 'MULTISITE' ) && is_main_site(); </code>

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)

Change History (0)

Note: See TracTickets for help on using tickets.