Title: cannot access $wpdb
Last modified: August 19, 2016

---

# cannot access $wpdb

 *  [g_force](https://wordpress.org/support/users/g_force/)
 * (@g_force)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/cannot-access-wpdb/)
 * Hello.
 * I am not able to call `$wpdb->prefix` or seemingly any wp property from a plugin
   that I am creating. I have read a few things but they don’t seem to correspond
   with newer versions.
 * Thanks for any comments
    _ g_force

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Arwym](https://wordpress.org/support/users/arwym/)
 * (@arwym)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/cannot-access-wpdb/#post-1969185)
 * Having the same problem here. I get errors as if the object didn’t exist.
 *  [Arwym](https://wordpress.org/support/users/arwym/)
 * (@arwym)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/cannot-access-wpdb/#post-1969186)
 * Okay, to everyone who encounters this same issue, please try including the file“
   wp-load.php” before globalizing $wpdb and making any reference to it.
 * Like this, for instance, which worked for me:
 * `require_once('../wp-load.php');`
 * That’s a relative path, so change it according to your own particular scenario.
 * Now, maybe I missed it, maybe it’s really not there, but it seems there are way
   too many people having this problem, so there has to be something failing with
   the documentation at the WordPress Codex.
 * Anyway, including that file should help.
 * I hope this solves it for you.
 * **Reference**: [http://wordpress.org/support/topic/need-help-accessing-wpdb?replies=4](http://wordpress.org/support/topic/need-help-accessing-wpdb?replies=4)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘cannot access $wpdb’ is closed to new replies.

## Tags

 * [prefix](https://wordpress.org/support/topic-tag/prefix/)
 * [tables](https://wordpress.org/support/topic-tag/tables/)
 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * 2 replies
 * 2 participants
 * Last reply from: [Arwym](https://wordpress.org/support/users/arwym/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/cannot-access-wpdb/#post-1969186)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
