Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What could I put in my theme to tell if a post is in the trash or not?

For example:

<?php if (is_trash) echo 'This post is in the trash!' ?>
share|improve this question
2  
Still not solved? Or just abandoned? –  toscho Jul 16 '12 at 23:25
add comment

1 Answer

You could use get_post_status():

function is_trash( $post_id = 0 )
{
    0 == $post_id and $post_id = get_the_ID();
    return 'trash' === get_post_status( $post_id );
}

Side note: To get a list of all registered post status objects use get_post_stati() – yes, that's wrong.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.