Wordpress Multisite changes download folder on sub-sites

Situation

I have a Wordpress Multisite install via GIT that has the latest commit in each environment:

  • Local
  • Development of
  • Products

In wp-config.php

I am rewriting the main filesystem like wp-content, uploads, plugin and theme folder like this:

define( 'BLOGUPLOADDIR', $_SERVER['DOCUMENT_ROOT'] . '/media' );
define( 'UPLOADS', 'media');

      

Problem

Currently subsites do not use this route to handle media loading through this structure. In a local environment it works fine and the file structure goes to /media/sites/{blog.id}/{files}

. In production and development, this does not work and the files are uploaded to /wp-content/blogs.dir/{blog.id}/

.

The files are exactly the same, and the settings for each site are the same. I also looked in the database for each site and saw that local, dev and prod use exactly the same parameters.

I tried to look at the media upload workflow and realized that the following functions are used by defining the media upload file structure:

https://core.trac.wordpress.org/browser/tags/4.7.3/src/wp-includes/ms-default-constants.php#L0

Looking further, I see in the next function an alternative parameter does the rewriting.

Desired answer

I want to know what is causing the rewrite behavior on my local machine, so I can create a solution to run this in each default environment.

+3


source to share





All Articles