Customize the front-end and back-end login of WordPress

. In the example before user redirection at login, the logged in user will be redirected to the corresponding page regardless of the role. However, you can redirect users to specific pages based on roles or functions. The
For example, you can disable site users from accessing the administrative zone and redirect all users belonging to other roles to the dashboard. This can be done using the login_redirect filter hook. Consider the following codes: The load summary a351db0e4548a1d4e0494b899ffef1c is very self explanatory. Login_redirect filters the URL of the resource that the user must redirect when the login succeeds. In this example, if the user has the edit\u posts (all roles of the subscriber as edit\u posts) function, the user will be redirected to the dashboard. Otherwise, you will be redirected to the site home page. The
Custom login page settingsif a new custom login page is created, the default login URL can also be overwritten. To do this, you can use the login_url filter, as shown in the following code: In the load summary 6e2379cce31f11fc1958114bd7a396bd, call the add_query_arg function that adds the query parameters redirect_to and reauth to the URL. The same URL is eventually returned by the callback function. Male login programmatically and add logout menu items now have a new login URL, which can be linked programmatically in the script. The following example shows how to add login and logout links to the main menu. The
Copy and paste the following code block into the default file of the plug-in (or the functions.php file of the subtopic): The time load summary e03608de3795d952e86b43ba3e6393e4 wp\nav\menu\items filter allows you to add new items to the menu. When setting a specific topic location, customization only affects one customization menu. If the user is logged in, the callback function will automatically add the logout URL; otherwise, the login URL will be added. So far, we have learned how to log in users on the front end. However, you may prefer to stay logged in on your home page. Therefore, in the following example, you will see how to take advantage of many features, tasks, and filters that can be used to customize the page structure and add features to the login form. The
\
Look. Then, to add more functionality to the built-in login form, read the last and advanced example. The
It’s time to allow users to choose redirection URLs and give users more control over the login process. In the last example, you can select the URL of the page to redirect. First, use the following functions to add new fields to the login form: The load summary f35ac7ef05c130c89530316098369737 login_form operation runs after the password field and before the remember check box of the login form, so the callback function will print the selection menu in the correct position. At this point, you can use the form fields to run with the following code: Load summary 1df1831b0ef284bc62168fbd0d74d0c6 verify here that the selection field has transmitted a valid value. If yes, the switch statement sets the value of the $redirect_to variable according to the option selected by the user. The custom login form will now be redirected to the page selected by the user. We are here to provide you with information. Another way for users to log in is to use their own free plug-in formator. Male enthusiast. Big glasses and everything. With his help, you can easily set up registration and login forms on the WordPress website. There are many customization options. Required information fields, safety characters, memory settings, etc. The popular 4.5-star plug-in has a reason. Read how to set up the login form for free today. The final login process is an important part of the website user flow. As a web designer, we need to take time to consider the user experience. Whether you decide to allow users to log in at the front end of the site or maintain the default back-end login format, you can customize all options from a presentation and functional perspective. The text printer provides customization. It depends on the user. Flag credit Giulio Baccari. Do you have any other ideas about custom login? Do you have any favorite examples of custom login forms? Participate in the dialogue and share it with us in the comments below. Tag: login as

Author:

Leave a Reply

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