Add WordPress post by category to website – SQL help!
-
Ok, maybe you can help me! I’m trying to put some of the posts from my wordpress blog onto my website, but I only want the posts that I have under the category of “Desk”. So, here is the sql I tried to use (I’m new to php so bear with me!):
SELECT *
FROM wp_posts, wp_terms
WHERE wp_posts.post_status = ‘publish’ AND wp_posts.post_type = ‘post’ AND wp_terms.name = ‘desk’
ORDER BY wp_posts.post_date = ‘DESC’
That code pulls up everything in the desk category but for some reason it doubles the post so I have 2 of every post?!?! Not really sure why. I think maybe I need to do something with some type of JOIN but that is new to me! Any help?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add WordPress post by category to website – SQL help!’ is closed to new replies.