The problem is that changing the post visibility to private invokes a status change, in a way private is not only a visibility but also a publishing status. Or to quote the WordPress Codex, section »Content Visibility – Private Content«.
Once you change the visibility to private, the post or page status
changes to “Privately Published” as shown. Private posts are
automatically published (…).
To achieve what you want you probably have to work with the publish_post or even better the publish_future_post hook. Another possibility is to work with Post Status Transitions and the according hooks.
Related Posts:
- Let private posts stay in status “private” after edit through “editors”
- 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
- Manage Private Posts
- 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?
- Separate Database Tables For Different Post Types
- Disable WordPress’ blogging functionality and disable ‘posts’
- strip only specific tags (like ), but keep other tags (like )
- post_name empty after wp_insert_post
- Pagination not working on Custom Page Template
- How can I specify a category post on my home page
- Trying to put an array into ‘post__in’ => array() query not working
- How to search only by post title and category?
- Is there a way to change the color of a row in Post Administration based on the type of post?
- Phantom 302 status code when sending a POST requests on pages
- How to change what the post creation page looks like?
- Does WordPress remove draft status automatically?
- Permalink Settings: optional settings doesn’t apply to editor
- Limit number of posts a user can make per minute?
- How do I allow users to follow a post and then allow admins to email all users who have followed that post?
- Is there any WordPress alternative to Book module of Drupal?
- Post Navigation
- wp_query ‘s’ parameter does not work with custom post type
- WP Query – duplicated posts once including tags in search results
- XML-RPC and post_date
- View the number of entries recorded per day
- Define a wordpress constant through plugin functions?
- Show all posts in sidebar in single.php
- Duplicate posts and change category
- recent posts for different categories
- import mailchimp newsletters into wordpress [closed]
- Is there a PHP script to replace post date with updated modified date
- Display News Posts by Day with Post Counter
- Change Post Status From Front End
- Blog posts not displaying
- Customizing Comments on Posts
- Disable sticky option for specific categories
- Make post_content and other custom fields required
- How do I Redirect a WordPress Page?
- Random posts from a pool of posts
- Crazy Question – Updating Post ID
- Post Image not displaying in category view
- Prevent Title Edit In post.php
- relating business and products with custom taxonomy?
- Send POST request to WordPress to make a new post
- Append ‘Continue Reading’ link if post length is more than 3 lines of text?
- Edit multiple custom post types while saving a new or edited post
- Moving the blog page
- Is it possible to lock all new and existing WordPress posts to one specific author?
- How to style archive post titles… but only those posts who have comments?
- How to check if there are posts with the same tag
- Can i have more than one form for front end posting in one template [closed]
- How do I allow certain users to make a certain type of post?
- How To Download WordPress Audio Attachments
- How to make blog posts have their own urls?
- How to add content above footer in posts from specific category
- Show posts from two specific category in WP_Query
- How to pull latest posts from a specific category
- Is it possible to change the default WP post table’s data source?
- call to jquery ajax failing with 500 error when passing extra data field
- How to create a button to filter posts (list) by meta value
- How to make certain posts not appear on the main page, but instead only a newly created category(in the menu section)
- Not able to post data through wp-admin
- Double loop output
- AJAX load more posts not using correct category and repeating the same few posts
- Multiple Pages – Seperate blogs
- Post by Email – Shortcode for Language? [closed]
- Difficulty in creating and handling a complex post type
- Admin is showing all posts on page 1
- Display only current page -> posts tags in page
- 3rd Party Login in wordpress
- How to mix pages and sub-categories in a url
- Show a Category Specific Info Box
- Formatting error while publishing theblog from Microsoft Word
- Overwrite URL on blog posts
- post content includes and seo vs. duplicate content
- Posts don’t appear on the Blog page
- Display the first post’s comments of category in comments.php template
- Create post from form with image
- WordPress 3.2 – Problem with WYSIWYG editors in a custom post type?
- 301 Redirecting posts without %postid% (just %post_name%) in permalink to ones with %post_name%_%postid%
- On the post list, how do you show different text to the main content?
- I am creating a front end dashboard where I need to show all the posts by the current user. So, I need to show posts in publish
- Display draft posts on single pages [duplicate]
- Need All the posts with id, title and date [closed]
- List posts related to category on a div [closed]
- query_posts different amount of posts per page [duplicate]
- How to get only post=’product’
- Function to delete post from category older than 2 days
- Display post archive as a month table, show last three months
- How to restore post to pending status (no draft)