X

Display wordpress login form anywhere with wp_login_form

Depending on how you are using WordPress you may have given users the ability to register to your website. Now all you need is a simple and beautiful way to let them register. This snippet will provide a simple way of adding that login form. Just add the first snippet in the location of your theme you wish to display the login form.



Code Snippet:


<?php
wp_login_form();
?>

The following more advanced login snippet includes an array of arguments that you can use to customize your login form even more. Some options are the labels username, pass, and of course the login redirect URL so you can specify a specific page a user is sent to after login.


Code Snippet:


<?php $args = array(
'echo' => true,
'redirect' => 'http://wpsnipp.com',
'form_id' => 'loginform',
'label_username' => __( 'Username' ),
'label_password' => __( 'Password' ),
'label_remember' => __( 'Remember Me' ),
'label_log_in' => __( 'Log In' ),
'id_username' => 'user_login',
'id_password' => 'user_pass',
'id_remember' => 'rememberme',
'id_submit' => 'wp-submit',
'remember' => true,
'value_username' => NULL,
'value_remember' => false );
wp_login_form($args);
?>

Comments  Leave a Reply

  1. Dart No Frills May 18, 2017 at 3:51 am

    Hi, i am Marco from Italy. I have an other question, my wp site has install qtranslate plugin, and when includ wp_login_form in my header.php file work only in default language version (en_EN). Do you have any ideas? Thanks.

  2. Web design Cheshire May 9, 2017 at 4:35 am

    Just what I was looking for! Thank you.

  3. Thanks

  4. How do i make it so it includes the Lost Password link? how do i include an ARG in the

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!