WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Why is my multisite default site getting data from wp_* instead of wp_1_* (2 posts)

  1. ancawonka
    Member
    Posted 1 year ago #

    I was upgrading a site from WPMU 2.9 to WordPress 3.4.2 and have run into something really confounding. I'm trying to figure out why it happened, and maybe fix it.

    Here's what I did

    1. Installed WP 3.4.2 and turned on WPMS.
    2. On top of the database for this site, I then loaded the database from 2.9 with my 13 sites in it.

    Everything worked like a charm everywhere except the main site, which is getting data, such as options, from the wp_* tables instead of the wp_1* tables. In the database, the different blogs are numbered, and the wp_1 tables exist (they're our old default site). In the dashboard, we can't go screens that affect to the wp_1 tables at all - all of our settings and such go into the tables for wp_posts, wp_options, etc.

    I just noticed this after we did a bunch of work on the site. The problem that finally made me look at the data was that we can't add users to the main site, and can't log in with any of the users that previously had access - but only for the main site.

    I'm really curious about how this happened, and in particular about how the multi-site stuff is hooked up at the database level. How could WordPress look at the default tables, instead of the numbered ones created by MS?

    Thanks,

    Anca.

  2. ancawonka
    Member
    Posted 1 year ago #

    Well, it looks like it's supposed to be working this way (a small difference between WPMU and WPMS. :) )

    From wp-db.php:

    function get_blog_prefix( $blog_id = null ) {
    		if ( is_multisite() ) {
    			if ( null === $blog_id )
    				$blog_id = $this->blogid;
    			$blog_id = (int) $blog_id;
    			if ( defined( 'MULTISITE' ) && ( 0 == $blog_id || 1 == $blog_id ) )
    				return $this->base_prefix;
    			else
    				return $this->base_prefix . $blog_id . '_';
    		} else {
    			return $this->base_prefix;
    		}
    	}

Topic Closed

This topic has been closed to new replies.

About this Topic