Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I found a little article on how to create a custom Wordpress Login page and I am wondering if this technique/practice is safe to use?

The article: http://blog.caercam.org/2012/09/21/wordpress-login-page-complete-redesign/

I have tried this technique but the Logout function stopped working in wordpress and if i write the wrong account username or password and click login it redirects me to the old login page is there a way to fix these problems?

I am using all the same code as in the article.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You have in many ways already answered your question: the technique described in the article is not going to be reliable. What you might not have worked out is "why".

The code uses relative URLS...

<form name="loginform" id="loginform" action="/wp-login.php" method="post">

... which are nearly always unreliable in WordPress context. That won't work if the site is installed in a directory so that the login url is at www.example.com/directory/wp-login.php.

Second, the code uses wp-login.php as the form action (not site_url('wp-login.php'), please note, or even wp_login_url() which would be correct), meaning that when you submit the form you go to the old login page for processing. If something goes wrong, that page is where you end up.

Third, the site_url regex hack will only work if you use site_url or functions that use site_url. It won't work if a plugin or theme does not use those functions, nor will it work if someone ( as I usually do ) just types wp-login.php into the address bar.

Fourth, regexing site_url is not the way to go. You are running regex every time that function is used. How many times is that going to used for a login link? Less than 1%? Very wasteful.

A better hook would be login_url, which is made for this circumstance.

Basically, this is a very superficial login page hack, not a "WordPress Login page complete redesign". There are better ways to customize your login page, the most straightforward being to use the actions and filters on the login page itself. If you choose to use a completely different page that wp-login.php you will need to duplicate most of the default functionality as that page has both functions and raw HTML and isn't easily included in other pages without making a mess.

share|improve this answer
    
Thanks for your help. How hard is it to do a WordPress Login page complete redesign would you say? I have created the HTML and CSS but i have no idea how to make it work. –  Pullapooh Jul 23 '13 at 16:04
    
While there are a lot of hooks, I wouldn't say the login page is especially easy to tinker with. There are quite a few questions on the site about it though. Start there. –  s_ha_dum Jul 23 '13 at 16:12
add comment

Your Answer

 
discard

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.