{"id":14426307,"date":"2021-05-11T15:53:30","date_gmt":"2021-05-11T15:53:30","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/password-protect-visibility-page-error\/"},"modified":"2021-05-11T15:53:30","modified_gmt":"2021-05-11T15:53:30","slug":"password-protect-visibility-page-error","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/password-protect-visibility-page-error\/","title":{"rendered":"Password protect visibility page error"},"content":{"rendered":"<p>I have found this code from <a href=\"https:\/\/www.boldgrid.com\/support\/question\/how-to-edit-password-protected-message\/\" rel=\"noopener\" target=\"_blank\">here<\/a><\/p>\n<p>When I add this, its redirecting to \/wp-login.php?action=postpass and showing a complete white screen. <\/p>\n<p>Can anyone please see if there&#8217;s any problem in the code? and give the correct one so that it works correctly. <\/p>\n<p>I am adding the code below. <\/p>\n<p>\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013\u2013<\/p>\n<pre><code>function my_custom_password_form() {\n\t\tglobal $post;\n\t\t$label = &#039;pwbox-&#039; . ( empty( $post-&gt;ID ) ? rand() : $post-&gt;ID );\n\t\t$output = &#039;\n\t\t&lt;div class=&quot;pa-lck-section&quot;&gt;\n\t\t\t&lt;div class=&quot;container&quot;&gt;\n\t\t\t\t&lt;form action=&quot;&#039; . esc_url( site_url( &#039;wp-login.php?action=postpass&#039;, &#039;login_post&#039; ) ) . &#039;&quot; class=&quot;form-inline post-password-form&quot; method=&quot;post&quot;&gt;\n\t\t\t\t\t&lt;p&gt;&#039; . __( &#039;&lt;b&gt;This is a subscribers only content.&lt;\/b&gt;&lt;br&gt; If you are already subscribed then enter your key you have received via mail and enjoy surfing. Incase you have not subscribed yet, please subscribe to receive your access key.&#039; ) . &#039;&lt;\/p&gt;\n\t\t\t\t\t&lt;label for=&quot;&#039; . $label . &#039;&quot;&gt;&#039; . __( &#039;Enter Access Key&#039; ) . &#039; &lt;input name=&quot;post_password&quot; id=&quot;&#039; . $label . &#039;&quot; type=&quot;password&quot; size=&quot;20&quot; class=&quot;form-control&quot; \/&gt;&lt;\/label&gt;&lt;button type=&quot;submit&quot; name=&quot;Submit&quot; class=&quot;button-primary&quot;&gt;&#039; . esc_attr_x( &#039;Submit&#039;, &#039;post password form&#039; ) . &#039;&lt;\/button&gt;\n\t\t\t\t&lt;\/form&gt;\n\t\t\t&lt;\/div&gt;\n\t\t&lt;\/div&gt;&#039;;\n\treturn $output;\n}\nadd_filter(&#039;the_password_form&#039;, &#039;my_custom_password_form&#039;, 99);<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-14426307","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14426307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14426307\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=14426307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}