[wp-hackers] ajax to call function in theme

scribu scribu at gmail.com
Thu Oct 29 19:44:10 UTC 2009


On Thu, Oct 29, 2009 at 9:39 PM, Sharon Chambers <sharon at brewerradio.com>wrote:

> Ok, I followed the tutorial, and am still unable to access $wpdb...
> Unfortunately, the doc leaves that to the developer, which is the one thing
> I can't figure out.
>
> Surely there's a way?
>


Just put this in functions.php:

add_action('wp_ajax_myfunction', 'myfunction');

function myfunction() {
 global $wpdb;

// do stuff here
 }

-- 
http://scribu.net


More information about the wp-hackers mailing list