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.

When I open a URL that point to a post which is not published yet, wordpress shows a 404 page. But I want to show a meaningfull message to user that "this post is not published by admin, please contact admin to get it published"

How can I do this?

Edit: Is their any way i can get wordpress to run my single.php template instead of 404 template in my case?

share|improve this question
    
Sorry for my asking, but how/why would one get to that page? I mean, how come anyone knows the link to an unpublished (and thus unmentioned/-linked) post? –  t f Apr 4 '13 at 9:31
    
@tf Referer from post preview. I get these each day. –  toscho Apr 4 '13 at 10:59
    
Actually in my case user can submit posts from front end and receives link in email. –  Ankit Apr 5 '13 at 11:10

1 Answer 1

Try to use this http://codex.wordpress.org/Function_Reference/get_post_status with a simple if statement inside of 404.php or single.php. I don't really know where it will work in that case, it's just an idea.

share|improve this answer

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.