MySQL Query to Get WordPress Post Categories

Spread the love

Here is pretty straight forward mysql query to get WordPress post categories. I’ve excluded the default Uncategorized category.

“wt.term_id <> 1″ to exclude Uncategorized Category and “wtr.object_id = 1” to get categories for post id 1.