-
AuthorPosts
-
July 24, 2020 at 10:18 am #25351Margaret SullivanGuest
Hello Boldgrid I would like to edit the message that is displayed on a password protected page. How do I do that? If I haven’t given them the password I want them to request information so i need to send them to a different page on the website.
It currently reads: This content is password protected. To view it please enter your password below:Password:
July 24, 2020 at 10:43 am #25357Jesse OwensKeymasterHello Margaret-
We have a support article detailing how to edit the WordPress password protected page, but I will go over it here as well.
There are a couple solutions for this issue. If you’re really just trying to modify the login form, you can use a plugin like WordPress Password Protect Page which lets you edit the form in your Customizer and gives you some more useful options.
If you’re looking to sell memberships and access to your content, I’d probably recommend a plugin like Paid Memberships Pro which gives you a lot more tools to promote your paid content, including adding marketing copy to your protected content.
If you’re looking for a fully customizable solution and you’re comfortable working in PHP, you can use a plugin like Code Snippets or your child theme’s functions.php to modify the password form with a filter. Here’s the code you can customize:
function my_custom_password_form() { global $post; $label = 'pwbox-' . ( empty( $post->ID ) ? rand() : $post->ID ); $output = ' <div class="boldgrid-section"> <div class="container"> <form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" class="form-inline post-password-form" method="post"> <p>' . __( 'This content is password protected. This is a custom message. To view it please enter your password below:' ) . '</p> <label for="' . $label . '">' . __( 'Password:' ) . ' <input name="post_password" id="' . $label . '" type="password" size="20" class="form-control" /></label><button type="submit" name="Submit" class="button-primary">' . esc_attr_x( 'Enter', 'post password form' ) . '</button> </form> </div> </div>'; return $output; } add_filter('the_password_form', 'my_custom_password_form', 99);
-
AuthorPosts
- The topic ‘how to edit password protected message’ is closed to new replies.