Support » Plugins and Hacks » Hacks » What files are needed to get wpdb running separately?

  • What files are needed to get wpdb running separately outside of wordpress. I moved wp-db.php and wp-config.php and the thing works ok, but I guess it’s missing something more.

    I cannot do queries like $user_count = $wpdb->get_var( “SELECT COUNT(*) FROM $wpdb->users” ); The $wpdb->users part appears blank.

    What other files does wpdb rely on?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You cannot load WP files piecemeal and expect things to work properly. If your task does not require theme support, you could define SHORTINIT as true before wp-settings.php is loaded to get basic functionality.

    To determine the files needed for SHORTINIT, trace through all the include and related lines starting with wp-load.php until you hit if ( SHORTINIT ) return false; in wp-settings.php.

Viewing 1 replies (of 1 total)
  • The topic ‘What files are needed to get wpdb running separately?’ is closed to new replies.