WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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 '13 at 14:08
What is the difference between what you want and how things already work? – s_ha_dum Jan 28 '13 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 '13 at 21:02
up vote 0 down vote accepted

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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