i try to realize the following: posts with a custom post type should be password-protected by default
i found this which works great
https://wordpress.stackexchange.com/questions/4952/forcing-all-posts-associated-with-a-custom-post-type-to-be-private
but i dont want the posts to be private so i chanced
$post->post_status = 'private';
$post->post_password = 'some_default_password';
to
$post->post_status = 'published';
$post->post_password = 'some_default_password';
but then there is no password protection
how can i get this done?
The following code does this, but it only works when a new post (post_type) is created.
If we don’t check for
empty($data['post_name']), which indicates that a new post is being created, it locks all posts with thesome_default_passwordpassword.Code based in this WordPress StackExchange Q&A.