ms_upload_constants

Defines Multisite upload constants.

Description

ms_upload_constants(); 

Exists for backward compatibility with legacy file-serving through wp-includes/ms-files.php (wp-content/blogs.php in MU).


Usage

  1. if ( !function_exists( 'ms_upload_constants' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-default-constants.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ms_upload_constants(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-default-constants.php  
  1. function ms_upload_constants() { 
  2. global $wpdb; 
  3.  
  4. // This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT
  5.  
  6. if ( ! get_site_option( 'ms_files_rewriting' ) ) 
  7. return; 
  8.  
  9. // Base uploads dir relative to ABSPATH 
  10. if ( !defined( 'UPLOADBLOGSDIR' ) ) 
  11. define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); 
  12.  
  13. // Note, the main site in a post-MU network uses wp-content/uploads. 
  14. // This is handled in wp_upload_dir() by ignoring UPLOADS for this case. 
  15. if ( ! defined( 'UPLOADS' ) ) { 
  16. define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); 
  17.  
  18. // Uploads dir relative to ABSPATH 
  19. if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) 
  20. define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );