global $wpdb; $categoriesData = $wpdb->get_results("SELECT c.*,ct.* FROM {$wpdb->prefix}terms as c JOIN {$wpdb->prefix}term_taxonomy as ct ON c.term_id=ct.term_id WHERE ct.taxonomy='category' "); foreach($categoriesData as $key=>$category) { echo $category->name; }