vonkanehoffen
Member
Posted 1 year ago #
Hi!
I'm trying to get wordpress to show a "wrong password" message when a user tries to access a protected post (front-end) and enters an incorrect password. Currently it just shows the exact same form again.
I know the form can be customised with the 'the_password_form' filter, but can't see any variables passed back in the HTTP request that would allow me to conditionaly display some "wrong password" text from here.
Anyone have any idea how to go about doing this?
Bright ideas much appreciated!
Cheers
ttr738 did you manage to figure this out?
Or maybe someone else have an idea?
vonkanehoffen
Member
Posted 1 year ago #
Nope. Still don't have a clue about it I'm afraid! You?
antek
Member
Posted 10 months ago #
Not the cleanest thing ever but here is a solution:
if (!function_exists('theme_the_password_form')) {
function theme_the_password_form( $form) {
if (isset($_COOKIE['wp-postpass_' . COOKIEHASH]) && get_permalink() == wp_get_referer()) {
$form = '<p class="error">Invalid Password. Please try again.</p>' . $form;
}
return $form;
}
}
add_filter( 'the_password_form', 'theme_the_password_form');
hopefully that helps