The default text on password-protected posts in WordPress is: “This post is password protected. To view it please enter your password below:” This function lets you change that text and use your own custom text above the Password form. In the code below, replace line 7 with your own custom message.
function isareplace_password_form($content) { global $post; if ( !empty($post->post_password) && stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH])!=$post->post_password ) { $output = ' <form action="'.get_option('siteurl').'/wp-pass.php" method="post"> '.__(" This post is password protected. To view it please enter your password below: ").' <label for="post_password">Password:</label> <input name="post_password" class="input" type="password" size="20" /> <input type="submit" name="Submit" class="button" value="'.__("Submit").'" /> </form> '; return $output; } else return $content; } add_filter('the_content','isareplace_password_form');
John Smith
April 26th, 2017 at 7:32 pm
Newbie here. Where exactly do you save this code (what location) and what do you name it?
Isabel
April 26th, 2017 at 10:17 pm
Hi. Please see this for easy steps: 3 Ways To Add Custom Code To Your WordPress Website.