Title: Modifying the Password Protected message
Last modified: August 19, 2016

---

# Modifying the Password Protected message

 *  Resolved [lukeoly](https://wordpress.org/support/users/lukeoly/)
 * (@lukeoly)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/modifying-the-password-protected-message/)
 * Hi Everyone,
 * I’m trying to change text that appears when a user is asked to enter a password
   to enter a certain page.
 * The default text is as follows:
 * This post is password protected. To view it please enter your password below:
 * I want to change it to:
 * You must have a promo code to redeem this offer. To view it please enter your
   promo code below:
 * I initially thought of taking a look at the wp-pass.php but i’m not really php
   savy as yet.
 * Anybody how to do what i’m trying to do?

Viewing 1 replies (of 1 total)

 *  Thread Starter [lukeoly](https://wordpress.org/support/users/lukeoly/)
 * (@lukeoly)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/modifying-the-password-protected-message/#post-1419179)
 * Ok, I have a solution for this.
 * You have to open and edit the wp-content/themes/yourtheme/functions.php file.
   You can copy and paste the code below into this file just before the php close
   tag.
    This will then insert your custom text into password protect message field.
 * function replace_the_password_form($content) {
    global $post; // if there’s a
   password and it doesn’t match the cookie 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’,’replace_the_password_form’);
 * Depending on what your function.php file is you may also need to put aÂ <?phpÂ
   before this code and a ?>

Viewing 1 replies (of 1 total)

The topic ‘Modifying the Password Protected message’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [lukeoly](https://wordpress.org/support/users/lukeoly/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/modifying-the-password-protected-message/#post-1419179)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
