How does Wordpress link posts to categories in its database?

Posted by bcmcfc on Stack Overflow See other posts from Stack Overflow or by bcmcfc
Published on 2010-05-17T11:13:46Z Indexed on 2010/05/17 11:30 UTC
Read the original article Hit count: 295

Filed under:
|

At present I am displaying a list of the last 5 posts in a site's blog in its footer using this mysql query:

SELECT post_title, guid, post_date FROM wp_posts WHERE post_type = 'post' AND post_status = 'Publish' ORDER BY post_date DESC LIMIT 5

How can I edit this query to restrict the search to a particular category id? I thought it would be as simple as looking for a category field in the posts table but it isn't!

© Stack Overflow or respective owner

Related posts about Wordpress

Related posts about mysql