Uses
Uses | Description |
---|---|
wp-includes/wp-db.php: wpdb::tables() | Returns an array of WordPress tables. |
wp-includes/wp-db.php: wpdb::get_blog_prefix() | Gets blog prefix. |
Sets blog ID.
(int) (Required)
(int) (Optional)
(int) Previous blog ID.
File: wp-includes/wp-db.php
public function set_blog_id( $blog_id, $network_id = 0 ) { if ( ! empty( $network_id ) ) { $this->siteid = $network_id; } $old_blog_id = $this->blogid; $this->blogid = $blog_id; $this->prefix = $this->get_blog_prefix(); foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } foreach ( $this->tables( 'old' ) as $table => $prefixed_table ) { $this->$table = $prefixed_table; } return $old_blog_id; }
Version | Description |
---|---|
3.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wpdb/set_blog_id