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”.
Please share it using the social networking links to the right, and subscribe to the RSS feed to keep up with more great posts!
Categories: WordPress Tags: database, php, standalone, w3tc, wordpress, wpdb
Posted on Friday, March 18th, 2011
Very handy, thanks!
Thanks! This was exactly what I needed to set up a cron job using an independent php file with WordPress functions! You rock!
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 !
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?
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.
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.
inside wp-db.php I had to
because it was using some apply_filter function that was defined in there.
I’d be careful doing that as it will probably get overwritten with WordPress upgrades.
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.
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).