wordpress snippets last updated   : April 22, 2014
we now have 631 snippets

Display wordpress login form anywhere with wp_login_form

wordpress snippet

You may want to add a login form to customize your wordpress theme and this is something very simple you can do by adding wp_login_form() function to your theme. 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);
?>

  • CHris

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

jqsnipp.com | we just launched jquery snippets website