I have customized and styled the password protected form that shows up for protected pages by adding code to the functions.php file of my theme. This all works fine, but I would like to add a hyperlink to the text displayed on this form that leads to a page where people can sign up to receive the password. Does anyone know how this works?

Thanks a lot in advance.


  • Can you add the code you included in your functions.php. – Tunji Jan 2 '17 at 20:24

I assume the code you added to functions.php is a filter for 'the_password_form', where you've got something like:

function my_protected_post_form () {
    $myCustomizedFormCode = '<form action=....'
    return $myCustomizedFormCode;
add_filter ('the_password_form', 'my_protected_post_form');

So where you have the instructions to the user in that custom form code string, you just need some simple HTML to provide the link you want. For example:

    '[...]To view this protected post, enter the password below, or <a href="http://example.com/passwordsignup">request a password</a>.[...]'
  • Great @Emily :) Please accept this answer if it covers everything you need. – iguanarama Jan 3 '17 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.