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.

Each of our posts are reviews for individual games and we occasionally have to 'pause' the game by changing it from published to pending review. The problem is if the page is indexed by search engines, anyone trying to visit the link will get a 404, which is obviously not desired. I'd like to instead redirect to a listing of all our games.

I can think of a few options but I'm not sure which would be preferred.

I could just do a temporary 302 redirect from that post to the game listing page. I'm not entirely sure how this will work for SEO however.

I could also do a check to see if the post is pending review (in the 404 page?), and if it is, then display the game listing page. I'm not entirely sure how to go about this. I tried finding a function to check if it's in pending review but didn't have any luck.

share|improve this question
    
Wouldn't a better solution be to find some way to indicate game pause than by unpublishing the post? For example: why not have a custom post type for "in progress" games, that can be updated continually as the game is played. Then, once the game is finished, post the actual review. –  Chip Bennett Feb 1 '12 at 21:05

1 Answer 1

up vote 3 down vote accepted

post_status is part of the $post object which you can use to determine if it is published, a draft, pending, etc.

if( $post->post_status == 'pending' )
    // do stuff
share|improve this answer
    
This actually worked for me. Thanks! I'll vote it up once I have 15 reputation points. –  Kyle Feb 1 '12 at 23:17
    
Glad it worked for you! :) –  Jared Feb 2 '12 at 0:42

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.