I would like to override the default WordPress Login page: wp-login.php
.
The reason is that, I want to write some custom code at the top of the file, that checks some conditions in the backend, and performs stuff like redirecting the user to some other page.
I would like to do this because I want to perform my own authentication logic in a custom file, without showing the default WordPress login form. My logic includes parsing of some cookie and session data (no login form in particular, may be a custom form).
I actually thought of writing my logic in the header.php
file of a child theme, but unfortunately the wp-login.php
file does not include the theme’s header file.
I don’t want to edit the wp-login.php
directly as I’am worried all my modifications will be lost with any future WordPress update.
Is there a way I can safely override the WordPress login page without incurring any loss after any WordPress update?
Or is it possible to route all requests to wp-login.php
, to a custom PHP file, so that I can write all my logic in that file?
Don’t modify core, use the actions and hooks system instead