WordPress.org

Ready to get started?Download WordPress

Forums

Add WordPress post by category to website - SQL help! (2 posts)

  1. kmiadv
    Member
    Posted 2 years ago #

    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?

  2. keesiemeijer
    moderator
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic