MYSQL: A Query to Display WordPress Posts

The following MYSQL query will display your WordPress post data including post metadata.   Just change the filters as required … demonstrated filters include only posts with a status of Publish and a post date less than Now.  Remember to remove the filter on post date if you are searching for Draft posts only.

SELECT posts.*, postmeta.*
    FROM wp_posts posts, wp_postmeta postmeta
    WHERE posts.ID = postmeta.post_id
    AND posts.post_status = ‘publish’
    AND posts.post_date < NOW()
    ORDER BY posts.post_date DESC
IMG_20140713_164442

 

About AussieBICG

Connect with me here https://au.linkedin.com/in/aussiebicg

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s