How to Create Front-end login form in WordPress without using any plugin
This is the easiest way to creating a simple front-end login form in WordPress, without using a plugin or making changes in your core wordpress file, Using wp_login_form for Front-End Login Forms.
This function “provides a simple login form for use anywhere within WordPress”. That means that without very much fuss, you can have a simple login form up and running in no time!
Here you’ll see an example usage of the function and using it with short code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
function login_form() { $args = array( 'echo' => true, 'redirect' => site_url( $_SERVER['REQUEST_URI'] ), '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 ); return wp_login_form($args); } add_shortcode( 'login_form', 'login_form' ); |
you can use shortcode “[login_form]” in widget or any post to create login form.
or you can use directly in your .php template file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
function login_form() { $args = array( 'echo' => true, 'redirect' => site_url( $_SERVER['REQUEST_URI'] ), '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 ); return wp_login_form($args); } |
[paypal-donation]