PressTigers

Using a WordPress Function to Create Custom Login Form

In WordPress, you can access the default login page by redirecting to site_url/wp-admin OR  site_url/wp-login.php. Additionally, WordPress allows you to create a custom login form at the front-end (either in a widget, pop-up or sidebar, etc.) of your website. This article will help you to create a custom login form by using a wp() function.

To achieve this functionality, WordPress provides you a wp_signon( $credentials, $secure_cookie ) function. This function uses the username, password and remember me as parameters. Using these credentials, this function will create a user session on the website.

If the given credentials are invalid, then it will return an error object holding the produced error or else it will return the user object on success.

And you are done!

User Comments

2 thoughts on “Using a WordPress Function to Create Custom Login Form

    Chris says:

    Where to put this code in to get a custom login page ?

      Azeem Afzal says:

      Hi Chris,

      Kindly place that piece of code in child’s theme Functions.php file with your credentials.

      Once you enter your credential and get logged in, it won’t ask again about your credentials.

      Regards,

      Azeem | Client Service Executive
      Email: support@presstigers.com

Leave a Reply

Your email address will not be published. Required fields are marked *

    Get in Touch