Multisite Doubt | Can one site data be used on another as if both are one site

If I install wordpress through Multi Installation Here →

http://photo.bollywoodhatke.com and

http://www.bollywoodhatke.com

all the media(Photographs are uploaded) in http://photo.bollywoodhatke.com/

so can I use the media’s(uploaded on http://photo.bollywoodhatke.com) while creating posts on http://www.bollywoodhatke.com
just like as if the medias are uploaded on the http://www.bollywoodhatke.com

I mean we can use it as smoothly as like using the add media feature on the single post pages of the http://www.bollywoodhatke.com.

Whoa that is super confusing to follow :sweat_smile: Data and Files are two separate concepts, so the answer to the title is yes they can share the same data, and yes they can share the same uploads directory. If you could clear up why you need to do this I might be able to provide a better solution.

Assuming they are all running the same install (they are both part of the same “multisite”), then you could try something like this:

/**
 * Force all network uploads to reside in "wp-content/uploads", and by-pass
 * "files" URL rewrite for site-specific directories.
 * 
 * @link    http://wordpress.stackexchange.com/q/147750/1685
 * 
 * @param   array   $dirs
 * @return  array
 */
function wpse_147750_upload_dir( $dirs ) {
    $dirs['baseurl'] = network_site_url( '/wp-content/uploads' );
    $dirs['basedir'] = ABSPATH . 'wp-content/uploads';
    $dirs['path'] = $dirs['basedir'] . $dirs['subdir'];
    $dirs['url'] = $dirs['baseurl'] . $dirs['subdir'];

    return $dirs;
}

add_filter( 'upload_dir', 'wpse_147750_upload_dir' );

This should be seamless, and the end user would not see any difference. You would add that to functions.php, definitely make a back up first though.

1 Like

sir, I will come back to the original question in the meantime can you please help me with this issue →

After all, I am finally able to create a multisite on my domain here: http://bollywoodhatke.com/

I created a subdomain of that multisite: http://pictures.bollywoodhatke.com/
See the image →enter image description here

but the site is hosted on the HostGator, and the sub-domain was not already created, but while creating the sub domain I came across a situation where I got confused the HostGator is asking for the document root? what document root should I give since the sub-domain has already been created so I guess the multi site WordPress has created a root. isn’t IT?enter image description here

I think since in multi site the database is same so the root should be the same of the primary or the first site?

Please guide me.

You’ll probably want to use a wild card domain, so that you don’t have to create the subdomain manually every time (see link for setting that up). You’ll also want the document root to be the same as the main sites root, which is probably just /public_html/ and not what you have there. You’re correct in that they use the same database, but in your case they’ll also use the same exact WordPress files.

This is actually the preferred way to set up a multisite-site. This link should help you get setup specifically with HostGator: https://www.blakeimeson.com/enable-wordpress-multisite-with-subdomains-hostgator/

WordPress multisite can be a little tricky to setup initially, but it’s a “set and forget” type thing so once it’s working you won’t have to do anything extra whenever you add more sites to your install.

quite confusing once you are saying do not set up manually then you are saying document root should be same. This is a Paradox.

when you say do not set this manually what I understand is in multisite there is no need to set this up from Hostgator, but use a wild card domain so that new sub-domain can be set from the Multisite dashboard, Right?.

It’s not a paradox. What I mean is that you don’t want to setup every single subdomain manually, a wildstar subdomain will automate this for you - so yes, you have to technically manually set it up once. The link I provided walks you through how to set it up step by step for your specific host.

Edit: I see where the confusion is, just follow the link I’m not great with words :smiley:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.