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

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? – tfrommen 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

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


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.