{"id":3461,"date":"2020-01-22T15:00:10","date_gmt":"2020-01-22T14:00:10","guid":{"rendered":"https:\/\/qodeinteractive.com\/magazine\/?p=3461"},"modified":"2020-09-01T15:21:00","modified_gmt":"2020-09-01T13:21:00","slug":"password-protect-wordpress-posts","status":"publish","type":"post","link":"https:\/\/qodeinteractive.com\/magazine\/password-protect-wordpress-posts\/","title":{"rendered":"How to Password Protect Your WordPress Pages and Posts"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><p>[vc_row][vc_column][vc_column_text]When we decide to put our content on the web, in the majority of cases we\u2019re looking to attract the largest audience possible. The more popular we become, the greater the likelihood our business will thrive.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]Sometimes though, we don\u2019t want to let just anyone see what we shared, or at least not immediately. Maybe we want to test a new version of our website and allow access to only a handful of people. We could also be a musician looking to share some new tunes, but only with a selected audience. Or we could be an inventor with a stellar product we\u2019ve not yet patented, so we want only people we trust to have access to that content.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]We\u2019ve already covered how you can <a href=\"https:\/\/qodeinteractive.com\/magazine\/create-wordpress-private-page\">make your posts and pages private<\/a>. But if you want to let only certain people see those private pages and posts in WordPress, all you have to do is password protect them. Then, only those with the correct password will be able to access the hidden content.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;68px&#8221;][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to Password Protect WordPress Page<\/h2>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;7px&#8221;][vc_column_text]The visibility of every post and page you create in WordPress is <strong>by default set to public<\/strong>. The process of changing it for both pages and posts is the same.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]As you go to create a new page or a post, take a look at the right-hand side of the screen. Next to <em><strong>Visibility: Public<\/strong><\/em> there\u2019s the option to <em><strong>Edit<\/strong><\/em> this setting. Click on it and this is what you\u2019ll see.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect.jpg\" class=\"attachment-full size-full\" alt=\"Password protect the page or post\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]Now, to password protect the page or post, all you have to do is <strong>select the <em>password protected<\/em><\/strong> option, <strong>enter your desired password<\/strong> in the designated field, and <strong>click OK<\/strong>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-1.jpg\" class=\"attachment-full size-full\" alt=\"Password protected option\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-1.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-1-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-1-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]In Gutenberg, these settings are also at the right side of the screen, under <em><strong>Documen<\/strong><\/em>t settings. Just click on <em><strong>Public<\/strong><\/em>, for additional options to appear.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-6.jpg\" class=\"attachment-full size-full\" alt=\"Password protect in Gutenberg\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-6.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-6-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-6-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]From this moment on, whenever you want to access that page or post, you\u2019ll have to enter the correct password in the password form to see the protected content.<br \/>\n[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-2.jpg\" class=\"attachment-full size-full\" alt=\"Enter the password to see the content\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-2.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-2-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-2-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]You can also easily check which posts and pages are protected with a password. From your admin menu go to <em><strong>Pages\/Posts &gt; All Pages\/All Posts<\/strong><\/em>. All password protected pages and posts will be clearly marked with the text: <em><strong>Password protected<\/strong><\/em>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-3.jpg\" class=\"attachment-full size-full\" alt=\"Password protected pages and posts\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-3.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-3-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-3-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;90px&#8221;][vc_separator color=&#8221;custom&#8221; accent_color=&#8221;#f0f0f0&#8243;][vc_empty_space height=&#8221;50px&#8221;][vc_widget_sidebar sidebar_id=&#8221;top-picks-banner&#8221;][vc_empty_space height=&#8221;28px&#8221;][vc_separator color=&#8221;custom&#8221; accent_color=&#8221;#f0f0f0&#8243;][vc_empty_space height=&#8221;80px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to Quickly Change the Visibility Status<\/h2>\n<p>[\/vc_column_text][vc_column_text]To change the audience of your posts and pages, you don\u2019t have to go into every post and page separately. You can modify the setting <strong>from the page\/post list<\/strong>, by hovering over the post\/page that you wish to protect with a password and then clicking on <em><strong>Quick Edit<\/strong><\/em>.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-4.jpg\" class=\"attachment-full size-full\" alt=\"Quick edit page or post\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-4.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-4-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-4-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]All that\u2019s left to do is to enter the password and then press the <em><strong>Update<\/strong><\/em> button (on the right side of the screen).[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-5-1.jpg\" class=\"attachment-full size-full\" alt=\"Enter the password and update\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-5-1.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-5-1-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-5-1-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;79px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">How to Hide Password Protected Posts from Your Website<\/h2>\n<p>[\/vc_column_text][vc_column_text]Setting a password for some of your posts will certainly limit its audience, but that post will still appear in the post list, on the author\u2019s page, in search results, etc. If you\u2019d like to hide it altogether so that no one else can see it unless they have a direct URL to it, you have two options.[\/vc_column_text][vc_empty_space height=&#8221;28px&#8221;][vc_column_text]One is to install the <a href=\"https:\/\/wordpress.org\/plugins\/whp-hide-posts\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress Hide posts plugin<\/a>. That way, before you publish a new post, you\u2019ll see the <em><strong>Hide Posts<\/strong><\/em> option at the lower right side of the screen. Simply tick the boxes for the places where you don\u2019t want your posts to show up.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;]<div class=\"qodef-single-image-holder   qodef-has-border \">\n    <div class=\"qodef-si-inner\" >\n                                    <img loading=\"lazy\" decoding=\"async\" width=\"710\" height=\"378\" src=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-7.jpg\" class=\"attachment-full size-full\" alt=\"WordPress Hide posts plugin\" srcset=\"https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-7.jpg 710w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-7-300x160.jpg 300w, https:\/\/qodeinteractive.com\/magazine\/wp-content\/uploads\/2021\/01\/Password-Protect-7-620x330.jpg 620w\" sizes=\"auto, (max-width: 710px) 100vw, 710px\" \/>                        <\/div>\n<\/div>[vc_empty_space height=&#8221;38px&#8221;][vc_column_text]If you want to <strong>automatically hide all password protected posts from your website, you can achieve that through some custom coding<\/strong>. Paste the following code in the functions.php file of your theme, and all your password protected posts will be hidden from your site.[\/vc_column_text][vc_empty_space height=&#8221;50px&#8221;][vc_column_text]<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">\/\/ Hide password-protected posts\r\nfunction exclude_password_protected_posts($where) {\r\nglobal $wpdb;\r\nreturn $where .= \" AND {$wpdb-&gt;posts}.post_password = '' \";\r\n} \r\n\/\/ Where to hide the password-protected posts\r\nfunction exclude_password_protected_posts_action($query) {\r\nif( !is_single() &amp;&amp; !is_page() &amp;&amp; !is_admin() ) {\r\nadd_filter( 'posts_where', 'exclude_password_protected_posts' );\r\n}\r\n} \r\n\/\/ Action to queue the filter at the right time\r\nadd_action('pre_get_posts', 'exclude_password_protected_posts_action');<\/pre>\n<p>[\/vc_column_text][vc_empty_space height=&#8221;59px&#8221;][\/vc_column][\/vc_row][vc_row][vc_column][vc_column_text]<\/p>\n<h2 class=\"qodef-h4\">Conclusion<\/h2>\n<p>[\/vc_column_text][vc_column_text]No matter the type of website you have, knowing how to password protect your WordPress pages and posts allows you to manage your content safely, restrict access to it and keep it secure from an unwanted audience. Even if you\u2019re not an experienced developer, you can do it in mere minutes. This will ensure only a selected few have access to your work, before (or if) you decide to share it with the rest of the world.[\/vc_column_text][\/vc_column][\/vc_row]<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>In this article, we\u2019ll show you how to password protect your WordPress pages and posts, so you can keep them secure from an unwanted audience.<\/p>\n","protected":false},"author":4,"featured_media":8062,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[14,47,13],"class_list":["post-3461","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-core","tag-plugin","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/3461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/comments?post=3461"}],"version-history":[{"count":0,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/posts\/3461\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media\/8062"}],"wp:attachment":[{"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/media?parent=3461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/categories?post=3461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qodeinteractive.com\/magazine\/wp-json\/wp\/v2\/tags?post=3461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}