Let private posts stay in status “private” after edit through “editors”

I’m using some private posts for intern purposes. When an editor changes something on these posts, its status turns to pending “review” and I have to publish it again as a private post.

When an editor changes something on a normal page/post – that has already been published for public – the status doesn’t change, so I’m a bit confused.

Is it possible, to force wordpress, to let the private status untouched, when an editor works on these posts?

Thanks a lot!

Edit:

For everyone dealing with the same problem: I was able to fix it with a code snippet of another thread: https://wordpress.stackexchange.com/a/172556/87321

Just had to add the post status “pending”, so the working solution is:

add_filter('wp_insert_post_data', 'mark_post_private'); 
function mark_post_private($data)
{
    if(($data['post_type'] == 'your_post_type_goes_here') && ( $data['post_status'] == 'pending'))
    {
        $data['post_status'] = 'private';
    }

    return $data;
}

2 s
2

As it doesn’t look as though the OP is coming back, I’m adding their answer as an answer rather than leaving it in the question:

For everyone dealing with the same problem: I was able to fix it with
a code snippet of another thread:
https://wordpress.stackexchange.com/a/172556/87321

Just had to add the post status “pending”, so the working solution is:

add_filter('wp_insert_post_data', 'mark_post_private'); 
function mark_post_private($data)
{
    if(($data['post_type'] == 'your_post_type_goes_here') && ( $data['post_status'] == 'pending'))
    {
        $data['post_status'] = 'private';
    }

    return $data;
}

Leave a Comment