Sql command needed
-
Hi;
Tried posting this message in Wp-Advanced category but doesn’t let me for some reason.Question: what is the SQL command I need to use to retrieve the last 4 posts from the database?
I am using:
$posts = “SELECT * from $wpdb->posts WHERE post_type=’post’ ORDER BY post_date DESC LIMIT 4”;
That works, except if I don’t post anything for one day, that command doesn’t pick up anything. How can I do this so that I always have the last four posts, regardless of when I published them?
Thanks for any suggestions.
Lode
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Sql command needed’ is closed to new replies.