# Solved: Wordpress Recent Posts Shows Pending Posts..?!



## MarkHaigh (Mar 21, 2010)

Hi all,

I'm using the Wordpress function wp_get_recent_posts - the output is fine except for the fact it outputs posts that are still pending..! (And if you click the link you get a 404 error, because it is pending).

Same for posts that are draft or marked private.

I see no options on the function to specify post status but surely by default it should only output Published posts..?

This is the latest version (WP2.9.2).

Confused..!


----------



## MarkHaigh (Mar 21, 2010)

No-one else come across this problem?


----------



## colinsp (Sep 5, 2007)

You may be better off asking on the WordPress forum, there are more experts on it there than here. I use WP a lot and have not come across that problem.


----------



## Gigacore (Jul 19, 2007)

@Mark, wp_get_recent_posts is outdated template tag. Now there is a new way to do this.

Try this method: http://www.noob2geek.com/wordpress/how-to-display-recent-posts-in-wordpress/


----------



## MarkHaigh (Mar 21, 2010)

Gigacore said:


> @Mark, wp_get_recent_posts is outdated template tag. Now there is a new way to do this.
> /


Thanks - using get_posts does seem to be the answer to this.

It's odd that wp_get_recent_posts hasn't even been deprecated yet. I just managed to find a blog post from 2005 discussing the same bug/undocumented feature.


----------



## Gigacore (Jul 19, 2007)

You are welcome, Mark! I'm glad it helped you


----------

