Wordpress help anyone?

glew

Junior Member
Joined
Feb 10, 2008
Messages
141
Reaction score
95
I'm trying to get the latest post based on time and date from the wordpress database and store it in a variable? I've been racking my brains and just can't get it. Any help would be appreciated :)
 
Here's the SQL query (assuming you didn't set a custom table prefix when you installed WordPress):

Code:
SELECT * FROM `wp_posts` ORDER BY `post_date` DESC LIMIT 1;

How you query the database depends upon which language you're using.
 
Even better use the built in function

This will get the most recent post 10 posts.
Code:
wp_get_recent_posts(10);

Search the WP document on this function for other paramaters that you can use with it as well.
 
Back
Top