Change WordPress' Default Password Protected Post Text

WordPress has a great feature that allows you to password protect individual posts from site visitors. To view the posts all your users need is a password. No annoying registration and email confirmation to mess with. While this feature works great out of the box, perhaps you may want to spice things up a bit by adding a custom message to tell the user some information other than the default:

“This post is password protected. To view it please enter your password below:”

Changing this default text is easy using WordPress filters

If up would like to change this text to let people know how they can obtain a password. Where do I make these changes. I don’t see it in the theme files.

How to Modify the Default Text

We will be using WordPress Filters to change the default password protected post function the_password_form. By using WordPress filters we effectively sidestep modifying the core files and ensure that our theme is that much more cool.

First, backup your theme’s functions.php file

It’s always a good idea to have a backup ready in case something doesn’t go as expected and you have to revert back to an older version. If you don’t have a development environment and are coding commando then make sure you backup your theme’s function.php before doing any editting.

Add the Following Filter to your theme’s functions.php file

To edit the text for the password intro simply modify the line of text you see above to suit your needs. You can tweek this function as much as you want to suit your styping needs. Add headings, images and more to bring that extra customization to WordPress and set your blog apart from the rest.

Remember, don’t edit WordPress’ core files

You may have stumbled upon a solution from Google that suggest modifying /wp-includes/post-template.php and this is a bad idea. Please disregard this advice as it’s always in your best interests to not modify the WP core.

Help I’m getting a Fatal Error

OMG you blew up my WordPress! It’s going to be OK. Most likely there’s simply an extra PHP end-tag or one missing. Double-check that there’s no syntax errors in your functions.php file.

A special thanks to Michael Fields who I got this useful filter from over at

Devin Walker is a San Diego-based WordPress Developer and enthusiast. He is the author of several popular and highly-rated WordPress themes and plugins. In his free time he enjoys playing Golf and traveling.

Follow Devin: