How to set Post Visibility Settings

Prem Tiwari - - WordPress Snippets

Once you publish a WordPress post (or Page), it is visible to the public (by default). In WordPress terms, this means a post with a Published status has a default visibility of Public, based on the settings in the Publish box of a Edit Post Screen.

Checking Password protected reveals a text field for entering a password, that will be required to view that post. The password is limited to 20 characters.
Checking Private makes your post visible only to your site’s Users with the role of Administrator or Editor.


Password Size Limitation

You can set the maxlength to a value of 20 when replacing the password protection form as WordPress will only save the first 20 characters due to database constraints.

Add the Password Form to the Excerpt

With the get_the_password_form function, you can make the password form be the Excerpt for a password-protected post:

Hiding Password Protected Posts

Copy and paste the following code in your theme’s functions.php:

Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.