WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
Still not solved? Or just abandoned? – toscho Jul 16 '12 at 23:25

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

Your Answer


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.