6

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;
}
  • 3
    Post your edit as an answer and accept it ;-) – Pieter Goosen Feb 4 '16 at 18:02
1

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;
}
-1

I would check that your users have the same capability. It sounds like this is happening:

"Internally, WordPress sets the post status to publish when you click the "Publish" button, and WordPress sets the post status to draft when you click the "Save Draft" button. Similarly, if your website has users granted the edit_posts capability but not the publish_posts capability, then when those users start writing a new post, WordPress will display a "Submit for Review" button instead of a "Publish" button. Likewise, WordPress then assigns the post that user created the pending status when they press that button. "

Found here Wordpress Post Status

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.