Is there any easy way to query the WordPress database? I have an SQL query for the menu of my theme which pulls categories and their attributes straight from the terms and terms_taxonomy tables in the database. I would like to use the existing database connection that WordPress uses for everything.
Any ideas on how I can achieve this?