0

both main and second domain (addon domain ) are in same host i want to find a way to change upload directory to another directory that located in another domain root.

default location (first location) : My main domain upload directory is : /domains/domain1.com/public_html/wp-content/uploads

destination location (second location) : the destination directory. is : /domains/domain2.com/public_html/wp-content/uploads

I want to define second domain upload directory as main domain upload dir

I mean I want domain1.com upload directory uses from the second domain upload directory.

for example can i use another wordpress root location address from same host in this code in wp-config.php ?

 wp config function: define('UPLOADS', 'destination directory');

if its matter i use shared hosting and my control panel is directadmin

is this possible ?

0

Well, what you want to achieve saving uploads in another domain? You want to share the uploads folder with another domain?

Did you know you can use more than one domain (site) in a single WordPress Installation? It's called Multisite: https://premium.wpmudev.org/blog/ultimate-guide-multisite/

To change the upload dir. Just use the filter upload_dir. It's documented here:

https://codex.wordpress.org/Plugin_API/Filter_Reference/upload_dir

Be happy!

  • Exactly i want to share just upload folder between two websites for edd products. but in multisite there is some limit for manage, thank you a lot for your help i will test this , – Positive Mind Jun 19 at 13:30
  • can you help me how can i set this location as default location : /home2/username/domains/domain2.com/public_html/wp-content/uploads - I don't know how to use this filter. - if you can't its ok i try to find a way to use this and And I'm very grateful to you for your time. – Positive Mind Jun 19 at 14:00
  • First of all, changing uploads folder will only change where wordpress will save your uploads. How you would get the uploads in media library of wordpress to attach in some of your products? I think you could think in a solution to share the media of the sites. Like if i upload a media in my site, will appear in other site too, like a sync feature. Let's look if have some plugin to solve your problem. – Lucas Vendramini Jun 19 at 14:21
  • Yes, What I want is have access the files that I upload on one of the sites from another site too in media library, exactly as you said. – Positive Mind Jun 19 at 14:40
  • There is no php function to load another root of same host ? For example :$_SERVER['DOCUMENT_ROOT'] will be load current files directory , if in this : define('UPLOADS', 'destination directory'); we can put another domains files location (/domains/domain2.com/public_html/wp-content/uploads) - so the problem will be sloved but it seems there is no way for this . Is there a way to do this? – Positive Mind Jun 19 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.