How to Add a LearnDash Login Form, Login Modal and Password Reset
The learndash_login shortcode and block explained: the theme setting that enables the modal, every attribute for the login and logout states, the logo, and the password reset pages that replace wp-login.php.

LearnDash 4.18.0.1 can replace the WordPress login screen for learners with a styled modal and its own password reset pages, so nobody sees wp-login.php. The pieces are a theme setting, a shortcode with a block equivalent, and two pages. This guide covers each, with the attributes verified against the LearnDash 3.0 theme's shortcode file and the login and registration functions.
Enable the LearnDash login
Go to LearnDash LMS, Settings, General, and in the LearnDash 3.0 theme section switch on Login & Registration. The help text says that when active the LearnDash templates are used for user login and registration pages, and the stored value is login_mode_enabled. With it on, the login shortcode opens a modal instead of linking to wp-login.php, the course page's "Login" prompt for logged-out visitors opens the same modal, and the Logo Upload field in the same section supplies the logo shown at the top of the modal and in Focus Mode.
The option list reads "Default registration used" when off and "Customized registration enabled for LearnDash registration" when on, which hints at the second half of the feature: the modal's Register link goes to the LearnDash registration page when one is assigned, as covered in the registration page setup guide.
The login shortcode
[learndash_login] prints a login link or button for logged-out visitors and a logout link for logged-in users. Its attributes come in pairs for the two states:
login_url,login_label(default "Login"),login_icon(default login),login_placement(left or right, for the icon),login_class(default ld-login),login_button(true by default, renders as a button).logout_url,logout_label,logout_icon,logout_placement,logout_class,logout_button, with matching defaults for the logout state.url,label,icon,placement,classandbutton, which apply to whichever state is showing and override the paired values.preview_actionfor the block editor preview, andreturnwhich returns the markup instead of printing it.
When the Login & Registration setting is on and no login URL is given, the link points at the WordPress login URL with the current page as the redirect, and the shortcode loads the modal markup once per page for logged-out visitors on non-course pages. Clicking the link opens the modal in place. When the setting is off, the same link simply goes to wp-login.php. After login the visitor returns to the page they were on. The final arguments pass through a filter so themes can change the label or classes globally; the shortcode filters guide covers that mechanism.
Examples
[learndash_login]
[learndash_login login_label="Sign in" logout_label="Sign out" button="false"]
[learndash_login login_url="/account/" login_icon="" placement="right"]
The first gives a standard button that toggles between login and logout. The second renders text links with custom labels. The third sends logged-out visitors to your own account page, bypassing the modal.
Where to put it
The usual places are a header widget area or a block in the site header template, and the top of a members dashboard page. The LearnDash Login block renders through the shortcode and offers the same options in its sidebar. In a menu, use a custom link to the registration or account page for logged-out visitors; the shortcode cannot be placed in a menu item without a plugin that evaluates shortcodes there.
Password reset pages
By default the "Lost your password?" link in the modal goes to the WordPress reset screen. LearnDash can take that over too. Create a page with the reset form:
[ld_reset_password]
The shortcode accepts width like the registration form, and there is a Reset Password block. Then, under LearnDash LMS, Settings, Registration, assign it as the Reset Password page and optionally assign a Reset Password Success page. LearnDash treats the reset feature as enabled when the Reset Password page is set, which is exactly what learndash_reset_password_is_enabled() checks. From then on the modal's lost-password link goes to your page, the form requests the reset email, and after the learner sets a new password they are redirected to the success page when one exists. The action learndash_reset_password_success fires at that point. The reset email itself is still WordPress's, sent through the normal mail function, so mail delivery must work.
Styling
The modal and forms use the LearnDash wrapper and the accent colour from the theme settings, so matching your brand usually means setting the accent colour and uploading the logo. The classes on the shortcode output, ld-login and the button classes, are stable hooks for custom CSS, and the modal's markup can be overridden by copying the LearnDash 3.0 login modal template to learndash/ld30/modules/login-modal.php in your theme.
Common problems
- Link goes to wp-login.php instead of a modal. The Login & Registration setting is off, or you are on a course page, where the course template handles login itself.
- Modal opens but login fails silently. A security plugin that renames or protects the login URL often blocks the AJAX login. Allowlist the LearnDash login or disable the rename.
- Redirect after login goes to the wrong place. Another plugin is filtering the login redirect. LearnDash sends users back to the page they logged in from; see redirecting users to their last active course after login for a deliberate override.
When to get help
The modal and reset pages are a half-hour setup. Single sign-on, social login inside the modal, or a fully custom account area with login, registration and profile in one place are development projects our LearnDash services team handles; a LearnDash developer can also harden the login against bots without breaking the modal.
Frequently asked questions
Why does the login shortcode not open a modal?
Enable Login & Registration in the LearnDash 3.0 theme settings. Without it the shortcode links to the WordPress login page.
Can I change the Login and Logout text?
Yes, with the login_label and logout_label attributes, or label to set both at once.
How do I replace the WordPress password reset screen?
Create a page with ld_reset_password, assign it as the Reset Password page in the Registration settings, and optionally assign a success page.
Does the login modal work on course pages?
Course pages handle login through their own template prompt, so the shortcode links rather than loading a second modal there.
Add worldwincoder.com as a preferred source on Google, or open this article in your AI assistant to use it as a source.
