Meta Box
Support › MB Custom Post Type › Make CPT Private by default
Is it possible to make an entire CPT (all posts and archive) "Private"?
I only want these posts/archive visible on the frontend by the admin/editors, and for all others, I want it to show a 404, just like a standard private post does.
Is this possible?
Thanks
Hi,
You can use a custom code to set the post status to private when creating/updating a post. For example
function force_type_private( $post ) { if ($post['post_type'] == 'my_post_type') $post['post_status'] = 'private'; return $post; } add_filter( 'wp_insert_post_data', 'force_type_private' );
https://wordpress.org/support/article/post-status/