Make WordPress Core

Opened 4 years ago

Last modified 12 months ago

#51779 new defect (bug)

wpdb->get_blog_prefix() doesn't allow wp_1_tablename structures

Reported by: madtownlems's profile MadtownLems Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Networks and Sites Keywords:
Focuses: multisite Cc:


Context: We have some OLD networks (10+ years, started as WPMU, etc)

In the process of dropping our Domain Mapping plugin for WordPress's native support, I encountered the following problem. Some (probably very few) old networks have the root site's tables as wp_1_options (instead of wp_options).

if ( defined( 'MULTISITE' ) && ( 0 === $blog_id || 1 === $blog_id ) ) {
     return $this->base_prefix;

This logic explicitly prevents wp_1_options and friends as being queried, with requests to the root/base site going to wp_options (which doesn't exist).

Perhaps there could be some kind of sanity check that checks for the existence of tables with the prefix in this kind of situation?

Change History (2)

#1 @johnbillion
4 years ago

  • Version trunk deleted

#2 @ideag
12 months ago

Hi, @MadtownLems. It has been a while since you opened this issue. I'm wondering if you still have any sites where a potential fix could be testable?

Note: See TracTickets for help on using tickets.