I have a custom page called owner-login that has a wp_login_form()

How can I disable wp-login.php so that:

  • when a user writes wp-admin/ it will redirect him to the owner-login (if not logged)
  • when a user writes wp-login.php it will redirect him to the owner-login (logged/not logged)

Generally, I don't want to show wp-login, but to have the functionality for the scripts that require

  • keep in mind that out of the box WordPress adds pretty permalinks for example.com/admin /dashboard /logout and /login
    – Tom J Nowell
    Jan 28, 2013 at 14:08
  • What is the difference between what you want and how things already work?
    – s_ha_dum
    Jan 28, 2013 at 14:21
  • My custom page is a template page with wp_login_form(), but on failure or by typing wp-admin/ (!logged in) it shows the plain vanilla wp-login.php page, which I don't want it to be shown. I want it to be redirected to my template page but keep the functionality of wp-login.
    – Panagiotis
    Jan 28, 2013 at 21:02

1 Answer 1


Try something similar to this:

function is_login() {
    return in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) );
function redirect_login() {
    if ( is_login() ) {
add_action( 'init', 'redirect_login' );

You'll need to modify the URL it redirects to, and test thoroughly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.