SQL query for WordPress Posts

I have been trying to write a SQL select query for getting the all the posts made in wordpress blog (to create a latest news banner). This seem easy enough, doesn’t it. The problems arose due to the post revising done by the wordpress blog application, this was just added a layer of confusion. The wordpress blog database stores multiple records for a single post, one record each saved version of the post. However removing this layer, I found that a simple select query will do the job nicely, and here it is:

SELECT * FROM 'wp_posts' WHERE post_status='publish' order by post_date DESC

Nice and Simple :)

This entry was posted in Web Development. Bookmark the permalink.

6 Responses to SQL query for WordPress Posts

  1. UGG Boots says:

    I absolutely enjoyed reading your blog and turn up it both illuminating and interesting. I wish for be sure to bookmark it and plague it as again as I can.

    Thanks
    Bernice Franklin

  2. very good information you write it very clean. I’m very lucky to get this information from

    you.

  3. nice share, good article, very usefull for me…thanks

  4. Great article Thank

    you so much!

  5. Thanks for this useful article.

  6. Emily N. says:

    Hi, I’m very interested in Linux but Im a Super Newbie and I’m having trouble deciding on the right distribution for me (Havent you heard this a million times?) anyway here is my problem, I need a distribution that can switch between reading and writing in English and Japanese (Japanese Language Support) with out restarting the operating system.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>