Forcing two or more custom post type to be private
You can add multiple compared condition variable in single if condition using logical OR operator. For more knowledge of Logical condition click function force_type_private($post) { if ($post[‘post_type’] == ‘my_post_type1’ || $post[‘post_type’] == ‘my_post_type2’) { $post[‘post_status’] = ‘private’; } return $post; } add_filter(‘wp_insert_post_data’, ‘force_type_private ‘);