Using WordPress ‘login_form_bottom’ PHP filter

The login_form_bottom WordPress PHP Filter allows you to add content at the bottom of the login form, just before the closing form tag element.

Usage

add_filter('login_form_bottom', 'my_custom_content', 10, 2);
function my_custom_content($content, $args) {
    // Your custom code here
    return $content;
}

Parameters

  • $content (string) – Content to display. Default is empty.
  • $args (array) – Array of login form arguments.

More information

See WordPress Developer Resources: login_form_bottom

Examples

Add a “Forgot Password” link at the bottom of the login form.

add_filter('login_form_bottom', 'add_forgot_password_link', 10, 2);
function add_forgot_password_link($content, $args) {
    $content .= '<a href="' . wp_lostpassword_url() . '">Forgot Password?</a>';
    return $content;
}

Add a link to the privacy policy page at the bottom of the login form.

add_filter('login_form_bottom', 'add_privacy_policy_link', 10, 2);
function add_privacy_policy_link($content, $args) {
    $content .= '<a href="' . get_privacy_policy_url() . '">Privacy Policy</a>';
    return $content;
}

Add a custom message

Add a custom message at the bottom of the login form.

add_filter('login_form_bottom', 'add_custom_message', 10, 2);
function add_custom_message($content, $args) {
    $content .= '<p>By logging in, you agree to our terms of service.</p>';
    return $content;
}

Add a “Register” link at the bottom of the login form.

add_filter('login_form_bottom', 'add_register_link', 10, 2);
function add_register_link($content, $args) {
    if (get_option('users_can_register')) {
        $content .= '<a href="' . wp_registration_url() . '">Register</a>';
    }
    return $content;
}

Add social media login buttons

Add social media login buttons at the bottom of the login form.

add_filter('login_form_bottom', 'add_social_media_login', 10, 2);
function add_social_media_login($content, $args) {
    $content .= '<div class="social-login">
                    <a href="https://facebook.com/login">Login with Facebook</a>
                    <a href="https://google.com/login">Login with Google</a>
                </div>';
    return $content;
}