Take the 2-minute tour ×
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!

Reference: http://codex.wordpress.org/File:WP3.0-ERD.png

share|improve this question
add comment

1 Answer

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? –  m0r7if3r May 19 '12 at 10:58
add comment

Your Answer

 
discard

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.