Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131

Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131
Custom Password Protected Message – Code DPlugins

Custom Password Protected Message

If you put a post or CPT to password protected, and you want to change the default message, for example you want to put a link with a request the password contact form in the message then use the code below.

<?php
// Custom 'Password Protected Message'
add_filter('the_password_form', 'arsh_message');
function arsh_message ($output) {
    $default_text = 'This content is password protected. To view it please enter your password below:';
    $new_text = 'This content is password protected. To get a password Click <a href="/request-password/" style="padding:6px 10px;background-color:#383e42;color:#fff">REQUEST PASSWORD</a> or enter password below if you have already.'; // change this text as your need.
    $output = str_replace($default_text, $new_text, $output);
    return $output;
}
?>
Click to Copy