Top

rjshuttleworth on "Accessing posts in the trash from PHP"

May 3, 2010 by  

Hi all, (my first post)

I am trying to access posts from PHP that are in the trash. I know I can return content of a trashed post when I know the ID of the post, as I can use:

$post = get_post($id);
echo $post->post_title;

after issuing a: wp_delete_post($id);

but I’d like to be able to produce a list of trashed items for use in my site. Can anyone point me in the right direction? Ideally there’ll be some metadata that I can pull that I don’t know about yet, and that my google searches are failing to uncover! I’m effectively trying to select all posts in the trash for a particular author.

Thanks all!
R

Share

Comments

Facebook comments:

Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!





*
Bottom