Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

basically, I have a cookie with the category slug stored, using this data I want to query the database and return the ID of the category.

I am new to mysql and this seems like an advanced query that may need to use joins, any help or guidance would be much appreciated.

Thank you!


share|improve this question

1 Answer 1

Instead of writing custom SQL, you should be able to just use the native get_category_by_slug() which will return a full category object to include the category ID.

share|improve this answer
It is in a file completely separate from wordpress. – Mr D May 19 '12 at 2:50
What is in a file completely separate from wordpress? – mor7ifer May 19 '12 at 10:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.