• gromag

    (@gromag)


    This morning I’ve posted this question to stackoverflow forum but it seems it got unnoticed. Probably I should have posted it here in the first place.

    Hi

    I’m trying to get some understanding of how WordPress works and while inspecting the database I found that, in a multisite installation, there is a table called wp_site that seems always holding a single record with a corresponding site_id. I cannot understand (nor find on internet) what is the use of site_id when actually multisites seem to use wp_blogs and corresponding blog_id for identifying different sites.(https://codex.www.ads-software.com/Database_Description)

    Can someone shed some light on what should be my understanding of site_id?

    Thanks

    Giuseppe

Viewing 10 replies - 1 through 10 (of 10 total)
  • govpatel

    (@govpatel)

    As you noticed that wordpress does not call it blog any more they call it sites as multi sites or My Sites in old wordpress use to be blog

    Thread Starter gromag

    (@gromag)

    Hi Govpatel,

    thank you for replying. Can you articulate your answer further, please bear in mind I have very recently started using WordPress.

    Many thanks

    Giuseppe

    govpatel

    (@govpatel)

    Blog name has been replaced with Site in wordpress 3.0

    Patrick Daly

    (@developdaly)

    As far as code and database goes, “blog” is still used.

    The site_id is the domain associated with your WP installation. Through the use of plugins (i.e. Domain Mapping), its possible to have multiple site_ids.

    RT: @patrick Daly, perfect answer

    Patrick:

    Through the use of plugins (i.e. Domain Mapping), its possible to have multiple site_ids.

    Does that mean that the site_id is only related to the domain but not the blog?

    Will changing the site_id change the domain a blog is linked to?
    … or changing it would result in the info taken from the new id blog?

    Can blog_id and site_id be different?

    Can use site_id without or instead of blog_id? ( site_id seems to be “optional” ) I assume changing blog_id is enough to switch what sub-blog the functions should work on.

    I’m trying to get content from the main blog, and I found the info to do it, but I was wondering whether it’s possible to rather change the url (domain) of that content showing the blog they were called from, and keep the rest of templates unchanged, because it’d be easier than changing blog_id every time a content is read.

    It’s so simple, make it a rule of thumb and you’ll never forget. (remember you only have two thumbs!)

    site_id = the network
    blog_id = the sites (formerly known as blogs)

    That’s it!

    site_id=1 and blog_id=1 <– that’s your main domain. The one you installed WordPress on. By enabling multisite, it becomes the network and the site. This only happens once.

    site_id=1 and blog_id=2 <– that’s your second site.
    site_id=1 and blog_id=3 <– that’s your third site.

    Take a peek at your wp_blogs table. It’s a cool place! ??

    This all true – but if you look at how the database is built, it really appears they have built it to allow for many layers in the future.

    Like – if you look into wp_posts you can have site and blog id’s…I think this is is useful for WP Multisite – but almost a little bit of future-proofing.

    Sure! There’s a lot you can do. For example, automattic uses site_id=1 for all wordpress.com blogs and site_id=2 for self-hosted .org sites that use jetpack or stats.

    Clear enough. Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WordPress: difference between site_id and blog_id?’ is closed to new replies.