Title: Request: Private posts readable to defined user gr
Last modified: August 18, 2016

---

# Request: Private posts readable to defined user gr

 *  Anonymous
 * [22 years, 4 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/)
 * Hi,
    an interesting feature I missed in wordpress is to post private entries,
   which can be read by logged in users only. For example users at level 1 can’t
   post in the blog, but can read these “hidden” posts. McClane

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [davidchait](https://wordpress.org/support/users/davidchait/)
 * (@davidchait)
 * [22 years, 4 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32129)
 * If you search for ‘private’ or ‘draft’, there’s a whole discussion (and my analysis
   and tweaks of the code) for how to adjust the current wordpress code to your 
   liking.
    Basically, you could make it so that any logged-in user (userlevel >
   = 1) is able to see private posts — that’s trivial. Let me know if you can’t 
   find the thread and need me to re-analyze this specific topic… 😉 -d [http://www.chait.net](http://www.chait.net)
 *  Thread Starter Anonymous
 * [22 years, 4 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32216)
 * I searched for private and found many posts to the private function, but not 
   especially to my problem.
    I tried myself to edit the queries but I couldn’t 
   fit in the logged in userlvel in the head php.
 *  [jakeleesf](https://wordpress.org/support/users/jakeleesf/)
 * (@jakeleesf)
 * [22 years, 4 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32442)
 * even I made the post private, I can still view the post after I log out.
 *  Thread Starter Anonymous
 * [22 years, 4 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32520)
 * I would really like this feature as well. I’m currently using MT, but I am looking
   for other blog tools that have this feature, but none do. I would try to implement
   this hack, but I am not familar with PHP at all. Any suggestions?
 *  Thread Starter Anonymous
 * [22 years, 3 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32630)
 * davidchait,
    Thanks for your code. But it doesn’t work (well it works when you
   see the edit page, but in the normal site, it doesn’t) until you add the following
   line before your snippet because $user_level and $user_ID are not set when you
   are viewing the site. get_currentuserinfo(); // Refresh user data from session
   variables. Hope it helps.
 *  Thread Starter Anonymous
 * [21 years, 9 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32799)
 * I tried this (w/ WP 1.2), but it doesn’t seem to have any effect. When I run 
   the SQL, it pulls back the private posts, but they are never displayed.
    Any 
   thoughts? Thanks, Zak
 *  Thread Starter Anonymous
 * [21 years, 9 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32800)
 * oops – i got it! i wanted *anyone* who is logged in to be able to see private
   posts. i don’t allow registration, so as long as the user is logged in they are
   OK. My problem is that there is a typo above (“==” instead of “=”).
    Here is 
   the full code I put into wp-blog-header.php: `// Get private posts get_currentuserinfo();
   if (isset($user_ID) && ('' != intval($user_ID))) $where .= " OR (post_author 
   = $user_ID AND post_status != 'draft') OR (post_status = 'private'))"; else $
   where .= ')';
 *  [wassimk](https://wordpress.org/support/users/wassimk/)
 * (@wassimk)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32813)
 * I’m using WP WP 1.2.1 and this code hack works great except for one minor side
   affect.
    The categorys… the only categories that show up on the index.php page
   are ones with public posts, even if I’m logged in. The thing is I do have some
   categories that have only private posts. Any idea how to get all categories to
   display when I’m logged in?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Request: Private posts readable to defined user gr’ is closed to new 
replies.

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 8 replies
 * 4 participants
 * Last reply from: [wassimk](https://wordpress.org/support/users/wassimk/)
 * Last activity: [21 years, 7 months ago](https://wordpress.org/support/topic/request-private-posts-readable-to-defined-user-gr/#post-32813)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
