Using WordPress Database Class to access data

WordPress exposes an instance of a class named $wpdb that lets you access any table within your blog database. The following example gets a row from the users table and print the result as an associative array.

get_row("SELECT * FROM $wpdb->users WHERE id = 1", 'ARRAY_A');
print_r($user_info);
?>

Leave a Reply