1

there are 2 things I'd like to do: 1. set a post's visibility to private by default.

I've been looking around the web for a code or even a plugin that lets me do this. The problem I've run into is that the codes no longer work.

  1. set the pending review checkbox to true as well?

If someone can point me in the right direction, Id appreciate it.

Thank you

enter image description here

1 Answer 1

1

Found this snippet after more searching:

//Force posts of custom type to be private
//…but first make sure they are not 'trash' otherwise it is impossible to trash a post
function force_type_private($post)
{
    if (($post['post_type'] == 'post')

    {
    if ($post['post_status'] != 'trash') $post['post_status'] = 'private';
    }
    return $post;
}

add_filter('wp_insert_post_data', 'force_type_private');

Changed the boolean to:

if (($post['post_type'] == 'post')&&(!current_user_can('administrator')))

This makes sure only admin can publish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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