Custom Post Type - Password protected

This isn’t exact a Cwicly related question, but maybe somebody has a solution.

I use CPT UI to make a custom post type and all is working well.

Sometimes a (custom) post needs to be password protected. When (a) certain post(s) is/are password protected it/they doesn’t show at the main custom posts overview page, which is perfect.

But, at the single posts 't doesn’t handle the password field, which Wordpress uses for “normal” posts.

I tried to use in the single-custom-post-template the option “post_password_required()” in the show display conditions, that does work, it hides the content of the password-protected post, but I could’t find an option for a field to enter the password. But I do think, this isn’t “the” correct route.

There are plugins to handle this, but I want to minimalize the use of plugins a much as possible and do think there would also be a snippet and no-plugin-option available.

Thanks in advance!

2 Likes