WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

Hidden private posts for not logged in users

The private posts are by default only visible when logged in.

Override, show private posts for everyone

Is there a clever way to override this? Make it visible to everyone?

404 page

I know about using it in queries but the big problem is the 404 page that is shown. Instead of 404 template it should use single.php template.

share|improve this question
possible duplicate of Prevent private post 404 – s_ha_dum Jul 31 '13 at 20:41
The whole point of making a post private is to prevent not logged in users (including robots) from having access to it (preventing indexing, actually). If you want to give full access to those posts just don't make them private. If you need to group them just add a private tag or put them in a category called private. – Andrei Gheorghiu Apr 7 '15 at 10:37

As already mentioned in the comments, private posts are private for a good reason.

If you want to change this behaviour, you could probably alter the get_posts() which is used to retrieve your posts.

I did not try it, but this could work:

$args = array(
    'post_status' => array(
$myposts = get_posts($args);
share|improve this answer
You should flag and downvote such posts that you do not find useful ;-) – Pieter Goosen Dec 29 '15 at 8:29
OOOHHHH, think I misunderstood you. It is highly encouraged to post new answers to old posts, even when the post has an accepted answer. It keeps questions useful. As WordPress develops, things changes, so an answer that worked a year ago might not work anymore. Adding a new way to do something is really useful for future reference. Remember, an accepted answer is not always correct, I got a couple of accepted answers where I answered a question with an accepted answer, the OP found my solution more useful, unaccepted the other answer and accepted mine ;-). So feel free, answer any question – Pieter Goosen Dec 29 '15 at 17:36

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.