Title: Querying categories
Last modified: May 23, 2017

---

# Querying categories

 *  Resolved [Penfold1000](https://wordpress.org/support/users/penfold1000/)
 * (@penfold1000)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/querying-categories/)
 * I am using Isotope to do some funky filtering options based on the categories
   in MLA.
 * How do i query the database to get the list of categories under Att. Categories
 * Apologise – having a bit of brain freeze!
 * CHRIS

Viewing 1 replies (of 1 total)

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/querying-categories/#post-9161721)
 * Thanks for the question. You wrote “**_query the database_**“; I assume that 
   means you need some SQL help.
 * Here’s the simplest query I can think of:
 *     ```
       SELECT <code>wp_terms</code>.*, <code>wp_term_taxonomy</code>.* FROM <code>wp_terms</code> LEFT JOIN <code>wp_term_taxonomy</code> ON <code>wp_terms</code>.<code>term_id</code> = <code>wp_term_taxonomy</code>.<code>term_id</code> WHERE wp_term_taxonomy.taxonomy = 'attachment_category' 
       ```
   
 * NOTE: the `<code>` and `</code>` literals in the above example must be replaced
   by “backtick” characters.
 * You may have to change the `wp_` prefix, but the rest should work. You will get
   all the information there is. I am marking this topic resolved, but please update
   it if you have any problems or further questions regarding the above suggestion.

Viewing 1 replies (of 1 total)

The topic ‘Querying categories’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [David Lingren](https://wordpress.org/support/users/dglingren/)
 * Last activity: [8 years, 12 months ago](https://wordpress.org/support/topic/querying-categories/#post-9161721)
 * Status: resolved