Published on Mar 5, 2021

How to customize the Password Protected Form in WordPress

Sridhar Katakam

If you are looking to change “This content is password protected..”, “Password” and “Enter” text for protected posts/Pages, add this sample code in a Code Snippet and modify as needed:

add_filter( 'the_password_form', 'custom_password_form' );
function custom_password_form( $output ) {	
$original_strings = array( 'This content is password protected. To view it please enter your password below:', 'Password:', 'Enter' );
$translated_strings = array( 'Este contenido está protegido por contraseña. Para verlo introduce tu contraseña a continuación:', 'Contraseña:', 'ENTRAR' );
return str_replace( $original_strings, $translated_strings, $output );



For full control the entire form’s HTML could be changed, like this.