Comments on “Using wpdb, the WordPress database, outside of WordPress”, Page 1

You are currently browsing comments. If you would like to return to the full story, you can read the full entry here: “Using wpdb, the WordPress database, outside of WordPress”.

Leave a Reply to Jackson

Hi, is and , which you swear not to share with anyone, is .
If you're interested, I also have you can read at (optional).
Below are for this post:

11 Responses to “Using wpdb, the WordPress database, outside of WordPress”

  1. Braunson says:

    Very handy, thanks!

  2. Tim B. says:

    Thanks! This was exactly what I needed to set up a cron job using an independent php file with WordPress functions! You rock!

  3. Chiang Mai Expat says:

    Hi, exactly what I was looking for.

    I am trying to write a small WordPress widget that will display the most “facebook liked” posts. I was wondering how to add a link in the backoffice of the widget to manually refresh the counts (the results will obviously be cached).

    With your method, an ajax call to an external script that will retrieve all the posts and get their facebook likes will do the trick.

    Thanks a lot, this helps me a lot !

  4. Lee says:

    Thanks for this useful post.

    I have a separate CodeIgniter App and want it to create a user on a WP site on a separate domain which I would ideally want on a separate server. Do you know if this is possible or will they have to be on the same box?

    • Andrew says:

      I’m sure you could make this work, but you will probably have to be careful when specifying your database server in the WordPress configuration, setting it to localhost obviously wouldn’t work on both servers.

  5. Seth Caldwell says:

    this doesn’t seem to be working for me; I’m getting fatal errors when trying to load a page that uses wpdb.
    Inside the wpdb class I notice calls to “$db->” but where is this db variable ever created? I can’t find it.

  6. Seth Caldwell says:

    inside wp-db.php I had to
    require_once(“plugin.php”);
    because it was using some apply_filter function that was defined in there.

  7. george says:

    Unfortunately… using latest release, the class is dependent upon plugin.php… and of all things, load.php where a stinking function exists that causes nothing but problems.

    Great idea though.

  8. Jackson says:

    Or…

    define(‘WP_USE_THEMES’, false);
    require(‘./wp-blog-header.php’);

    http://codex.wordpress.org/Integrating_WordPress_with_Your_Website

    • Andrew says:

      Yes, you could do that, but my method loads 100x faster based on my unscientific testing (0.4 seconds vs 0.004 seconds on one of my production servers).