WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#33928 closed defect (bug) (invalid)

Multisite: in sunrise.php $wpdb->prefix is empty

Reported by: lordspace Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Database Keywords:
Focuses: multisite Cc:

Description

I was working on a multisite WP install and noticed that within sunrise.php
$wpdb->prefix is empty. I had to do this kind of workaround.

$db_prefix = preg_replace( '#_blogs$#', '_', $wpdb->blogs );

I also noticed that $wpdb->posts is empty too. Strange.

Change History (1)

#1 @johnbillion
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is intended behaviour.

sunrise.php can be used to override the site determination in multisite with your own logic (the most common use of this is domain mapping). The current site hasn't been determined at this point, and therefore the site-specific properties of $wpdb haven't yet been populated.

Note: See TracTickets for help on using tickets.