wordpress snippets last updated   : September 29, 2014
we now have 639 snippets

Display wordpress login form anywhere with wp_login_form

wordpress snippet

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.

snippet :  PHP - default login formcopy
<?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.

snippet :  PHPcopy
<?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);
?>

Did you like this post? If so please share it with your friends. Thanks!

  • CHris

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

  • http://www.iamniloy.com Niloy Sarker

    Thanks