Support » Plugins » Hacks » wpdb and include() questions

  • Resolved drlithium


    hi, I am new to WP programming and I am confused about how to properly use the WP include files and how to use $wpdb.

    I’d like to call get_user_by() and wp_check_password() from a PHP script that runs standalone. That is, the script is not invoked by any of my wordpress pages.

    I figure I’ll just include whatever file that’s missing, so I ended up adding the following one by one:


    and then I hit the wall — Fatal error: Call to a member function get() on a non-object in /home6/mymuscl3/public_html/wp-includes/cache.php on line 113

    ok, wrong approach. After reading up the documentation of get_user_by(), I discovered $wpdb. So I guess I am supposed to do this:

    globalize $wpdb;

    but the thing is, wp-db.php only defines the wpdb class. Where is the global variable $wpdb declared? Should I use wpdb(…) as a constructor directly? And if so, how to use $mywpdb = wpdb(…) to call get_user_by()?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wpdb and include() questions’ is closed to new replies.