WordPress Custom Post Status not Public but Viewable Through Link: Privately Published Posts


I have been working on my site to bring up private posts on my site. I built a custom post status for this purpose.

My goal is to exclude posts belonging to that post status from search, from Blog Page, from WordPress Queries, RSS Feed etc. Basically there should be no mentions of it anywhere on site.

Till here it seems simple, but the problem is that I WANT people to be able to view the post via direct link.

Basically I want it to be not mentioned throughout my site, but if someone visits it from direct link, they can view it.

function custom_post_status(){  register_post_status( 'privatised', array( 'label' => _x( 'Privately Published', array('post', 'download')), 'public' => false,  'exclude_from_search' => true, 'show_in_admin_all_list' => true,  'show_in_admin_status_list' => true,  'label_count' => _n_noop( 'Privately Published <span class="count">(%s)</span>', 'Aggregated <span class="count">(%s)</span>' ),  ) );  }  add_action( 'init', 'custom_post_status' );  

Here if you see in the Array, the first option is Public, and I set it to false, which basically ensures that my post is not there on my Blog Page, or search, or Taxonomy Page, or RSS FEED etc. Etc. But if I open the same post via it’s direct url, then it gives a 404, because not found…

Please help, me have my post visible only through the direct link of it.

As a sidenote, Is it possible that I can have it public, and then exclude it from Taxonomy and all, like I can do with exclude from search…