Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 786165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:59:46+00:00 2026-05-14T20:59:46+00:00

Is there an easy way to grab the latest posts out of a WordPress

  • 0

Is there an easy way to grab the latest posts out of a WordPress wp_posts table using a simple SQL query?

I have a WordPress 2.9.2 installation as part of, but separate from, a larger system. It has a customized theme to look like the rest of the site but has otherwise nothing to do with it. I want to display the latest handful of headlines of posts made using WordPress on a site of that other system. Preferably I do not want to mess around with importing any of the WordPress library files.

Looking at the database structure I can’t see an easy, straight-forward query to simply get the latest revision of the latest posts. The post_status can either be “post” or “inherit”, the post_type “post” or “revision” and the parent “0” or the id of the original post of a revision. I can’t figure out how to reliably filter different revisions of the same post, drafts, attachments and pages out of this mess and just get the latest revision of the latest posts.

I’m aware that the database schema is subject to change in subsequent versions of WordPress, so shouldn’t be relied upon, but that’s a minor concern, since it’s such a minor feature that could easily be fixed. If I understood how that database is supposed to work, that is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:59:47+00:00Added an answer on May 14, 2026 at 8:59 pm

    You’re looking for all posts where post_status = publish and post_type = post.

    The WordPress posts table also includes pages, revisions, and attachments … that’s why you need to be specific.

    If you’re using the default database scheme (with wp_ as a table prefix), the following query will give you what you need:

    SELECT post_title FROM wp_posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date DESC

    This will give you a list of the most recent headlines (post titles) of published posts ordered by date (with the most recent at the top). No need to import any core WordPress libraries. Just make sure not to accidentally tweak the database while accessing it directly or you might break something in WordPress.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easy way to grab a users twitter image with a simple
Is there an easy way to grab a attribute value from an xml item
Is there an easy way to grab the file name? I'm trying something like
Is there an easy way to grab a users LinkedIn profile photo? Ideally similar
Other than using raw XML, is there an easy way in .NET to open
Is there an easy way to log PHP errors to a log for a
Is there an easy way to generate docs for REST api direct from a
Is there an easy way of getting the datetime of the last change to
Is there an easy way in javascript to only escape certain ranges of control
Is there an easy way to calculate the derivative of non-liner functions that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.