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?
- How to add an admin notice upon post save/update
- Including categories in search results
- How does one reduce the number of stored revisions?
- How to Group Posts by the First Letter or Number?
- How to add editor’s name to entry meta byline?
- Use an attachment in multiple posts
- Using $wpdb to query posts with meta value containing current post_id
- Forcing oembeds to top of post
- I’m having some issues with previous_post_link() and next_post_link()
- Specify number of posts in my ‘tax_query’
- Can I change a post to a page by changing it’s type?
- Where is the “ancestors” post object attribute?
- How can I display a specific user’s first published post?
- custom single.php not working
- Append a to every post to force additional page link (and static content)
- Limit function to specific post category
- How to show a full post, not just an excerpt
- get selected post using $_GET
- WP_Query: offset ignored when posts_per_page is -1?
- Remove slashes (both before and after) in relative post url
- Post Filter by Date and time
- WordPress version 3.8 – Preview button not working for editor
- Get random posts between specific dates / of specific age
- Restrict post navigation to current sub menu
- Which URL to enter into browser to show all posts in archive.php?
- Using wp_list_categories like the the_category (showing just current categories of a post)
- Posts list in custom taxonomy
- How to return another post than requested
- Update post_content everytime a custom post is opened in backend
- Random ajax load only works with posts_per_page set to -1
- MySql query to get posts with all meta and terms
- Prepending %category% onto default posts fails
- How to display only feautured/sticky listings on the homepage
- Can’t update old posts 3.5.2
- Is it possible to paste a link without tags and make it directly a link in a post?
- Adding a blog archive with pagination using WP_Query
- How to get Tags with specific post id
- How to setup a query to output posts by groups of five?
- Get post content with all filters applied, knowing post id
- Is it possible to customize the post according to post format in single.php?
- Delete post after x minutes if user role is
- WordPress website loads more posts than expected
- Post type no single page
- How can I list posts by author?
- How to create a “latest news” page showing a list of posts from blog category
- Count several post tags
- How to generate/create link automatically on every word of post in wordpress
- Querying another post category to match current post and display in loop
- how to handle the loop using filling bootstrap grid structure?
- datepicker value in mysql
- Get author posts count after excluding a category
- How to edit the ‘
- List all native posts in template page?
- How to add PHP code snippet to all Post pages?
- How to display WP Query filters?
- Finding a post’s slug
- Is that possible put a whole POST in a list ,
- Order posts by date
- Conditionally exclude post from specific category on home page sidebar?
- MySQL: Possible to replace all of wp_posts.post_content(id#) via UPDATE + REPLACE + SELECT?
- posts and cms and posts again
- I want to add another search box on posts page in dashboard
- Move position in post list for a custom checkbox column
- How to create custom post page in WordPress?
- How to add a custom class attribute into code wrapper? [duplicate]
- Redirecting wordpress search query to archive page
- Does having category name in permalinks affect SEO when having a post in multiple categories?
- Delete attached images from posts
- Unable to edit or post after enabling SSL
- Dynamically load posts based on category
- show latest authors blog post
- Admin Post List Only Show One Category
- Featured Images link to post parent
- Checking if some condition is matched before inserting post into database
- how to create cron that post events daily in wordpress?
- External link not showing on post but showing on comment
- Posts being replaced/deleted
- TCPDF and permalinks
- How can i show only 30% of the “the_content(“More…”)”?
- wp_query select if have comments
- How do i put a dropdown list of ALL my post in the sidebar menu?
- Redirecting posts in WordPress to a specific page
- How to make post stick to its own div
- Numbers of new post since the last visit of user
- Post data returning null [closed]
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields