The problem:
1. We wanted to have a custom error page for a custom login previusly created.
The solutions:
- a) Make a copy of
wp-login.php
and name it as
myCustom-wp-login.phpin that page find line 55
<code>if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
add_action( 'login_head', 'wp_shake_js', 12 );</code>b) Replace this lines with
<code>if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
echo '<script type="text/javascript"\> window.location = "'. get_bloginfo('url') . 'my-error-page.php'. '"; </script>';
exit;</code> - Link that page to the form action of the
wp_login_form( $args = array ())
function or to your custom login_function (if have one)
Done!
Two more tips:
If you want to change the redirect to a custom page for successful login just change
‘redirect’ => ‘custom-page.php’ in the argouments of
wp_login_form( $args = array ())
function or your custom one.
Wp login redirect to a custom error page