I am creating a custom post type, for which I want all posts to be password-protected with the same password.
I realize that I can set a password on a post-by-post basis from within the admin panel, however this seems tedious and prone to error/forgetfulness.
I’m sure there’s a way to make this happen with some kind of filter, but I just don’t know where to start.
Any help would be greatly appreciated. Thanks!
If you want to make all the posts for a post type
password protected
with the same password then you can do run anupdate query
like below to make this happen.Use the following code in the active theme’s
functions.php
file.The above will make all the post type
post
password protected with the password aswpse
.