Find Wordpress category ID by category name using SQL
Problem:
You need the wordpress category ID for a given category name (e.g. My category
), e.g. for a shortcode filter.
Solution
You can use a SQL statement to find the correct category for your term (i.e. the category name, My category
). Run this statement in your database administration interface, e.g. phpmyadmin.
SELECT termtax.term_taxonomy_id FROM wp_terms AS terms JOIN wp_term_taxonomy AS termtax ON terms.term_id = termtax.term_id WHERE terms.name = "My category"
Replace My category
at the end by the category name you’re looking for.