You could perhaps:
1) Create the category for your Private posts, e.g. “Private”
2) Exclude the “Private” category from your main Loop
3) Output the “Private” category using a custom template file, e.g. category-private.php
4) Wrap the Loop in category-private.php
in an if ( is_user_logged_in() )
conditional
(This assumes, of course, that you are the only user of your site. You will need to modify if you have additional users.)
EDITED TO ADD:
5) Wrap the Loop in single.php
in an `if ( is_user_logged_in() || ! is_category( ‘private’ ) ) conditional.
6) Add an exclude=#' argument, where
#is the Category ID of the "Private" Category, to any call to
wp_list_categories()`.
Related Posts:
- Let private posts stay in status “private” after edit through “editors”
- Planned private posts get published immediately
- What differences are there between a Privately Published post and a Draft post?
- Private Posts/Pages & Search
- Are private posts visible to search engines?
- Whitelist Author of Private Post
- Show certain posts in a LIST format that members have been granted access to
- Post visibility based on user role
- How can I create an RSS feed that includes “Private” posts?
- Posts and Pages w. private visibility don’t show up in existing content
- How to set a Post’s default visibility to ‘Private’ in Gutenberg?
- Filtering private Posts
- How can I make my blog private? [closed]
- Making a private post visitable by link?
- Should we trust the post globals?
- How to get the number of posts in a selected category?
- how to limit edit_form_after_title hook to page and post edit only?
- Add a checkbox to post screen that adds a class to the title
- How to cache a shortcode functions output?
- count number of posts (public , private , protected) by category name
- How to call function within a page/post, to dynamically generate content?
- Post Size Limit
- How to force update all posts after import
- Programmatically inserting page breaks
- How to have different content in the loop and single
- Make “Post published. View post” Open in a New Tab
- Custom Post Type & Author not associating, user post count is 0, api doesn’t return author in post objects
- How can I extract the URL of a link from a post?
- New posts defaulting to ‘0’ primary key
- Save list from a custom meta box?
- Same content shared between multiple posts?
- How to add in title a date but with other color, like in iMDb titles?
- Remove custom posts that match taxonomy value
- WordPress – Admin Manage Posts – Multiple Filters by Parent Category
- Link button is not working while editing a post in Firefox [closed]
- Post Type Label Name
- Disable author profile in post
- Limit Gutenberg blocks available to users to choose from
- Display a post by ID attribute with shortcode
- Retain select value in select box
- How to set up multiple taxonomies for groups of posts
- Update admin side post list count text
- How can I set a Post’s default visibility to private and pending review checked
- Blog Posts in Custom Menu
- Receive each week the number of posts published
- How do I get blog posts to appear within CMS?
- Multisite: Can’t Post or Create Categories
- Query values from a Post Object Repeater [closed]
- limit to months rather than by number of posts
- Simultaneous admin updates causes custom fields to not update
- how to bulk add one line in the first paragraph of all posts
- Multiple Loops Breaking Pages
- Admin – no Featured image choice in create new/page|post
- Why this function doesn’t works without the_post?
- Why can’t publish posts with too much text?
- l accidentally permanently deleted a Draft. There’s any way I can recover it?
- wordpress add field to post_class
- How to store array in usermeta in wordpress
- Setting limit to posts or page creation
- write a post on user registration
- Cannot select certain authors for posts after import
- Lightbox on wordpress post page
- Can Permalink structure of %postname%/%post_id% improve performance
- post/page content
- WordPress Architecture as a CMS – Posts & Pages
- Getting post and attached image from subdomain
- How to list post as buch of category, and all of them
- Is it to possible to insert a page in the post depending on the category ofthe post
- How to display a “NEW”-icon on posts from today
- How to automatically share posts on facebook?
- Is there a way to categorize a list posts all at once?
- Display “no post” message
- Not adding a new post?
- Prevent the automatic URL linking added in last update
- On the online version of my blog posts disappear
- Thumbnails and images in the blog post are not loading
- Automatically delete post in a single category when a new one is created
- Multiple posts in one page
- post__in no longer works in wordpress 5.0.3
- Slug collision between page, taxonomy and custom post type
- Populate a drop down list with post titles across a multisite network
- What’s the best approach to create duplicated pages with paginated posts?
- including 404 page in post page
- How to allow some visitors to edit inline specific post
- Posts only showing on /localhost/wordpress/ and not on other pages
- How to change number of posts shown on homepage vs other pages?
- Posts are printed twice
- How to display most popular posts from certain category in sidebar?
- Is possible to do this from function.php
- Custom filter on all post page (admin backend)
- Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL’s?)
- Users cannot post when editor or admin on more than 1 site on multisite
- How can I create a menu items from meta box based on users input
- How can I count articles retrieved by tags
- WordPress strips some attributes for author posts
- Creating / Editing a post from within site template
- display only the title of the post into a certain category
- WordPress “Posts Page” isn’t showing template dropdown
- Post only showing on homepage when Logged in – direct URL still working
- How can I get on the same row two post of different categories?