require_wp_db

Load the database class file and instantiate the `$wpdb` global.

Description

require_wp_db(); 

Usage

  1. if ( !function_exists( 'require_wp_db' ) ) { 
  2. require_once ABSPATH . WPINC . '/load.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = require_wp_db(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/load.php  
  1. function require_wp_db() { 
  2. global $wpdb; 
  3.  
  4. require_once( ABSPATH . WPINC . '/wp-db.php' ); 
  5. if ( file_exists( WP_CONTENT_DIR . '/db.php' ) ) 
  6. require_once( WP_CONTENT_DIR . '/db.php' ); 
  7.  
  8. if ( isset( $wpdb ) ) { 
  9. return; 
  10.  
  11. $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );