I have created a custom login page that uses wp_login_form() to create the login form:

<div class="login-form">
    wp_login_form( array(
        'remember' => false,
        'label_username' => '',
        'label_password' => ''

I tried to add a simple message to the login form using the default example from the WordPress Codex page about the login form action hook, like this:

add_action( 'login_form', function(){

    //Adding the text

    <p>You can type a little note to those logging in here.</p>


I literally copy-pasted the last code snippet from the Codex into my custom themes functions.php, to test if it's working.

Now, when I open my custom login page, the text does not appear, but when I open the default login page, the text does appear.

So, does wp_login_form() simply not use the login_form action hook or am I missing something?

2 Answers 2


Yeah, it would appear, by taking a quick look at wp-login.php that it indeed does not tie to the actual form, but is run separately outside of the wp_login_form() function.

Lines 914-919 of wp-login.php

 * Fires following the 'Password' field in the login form.
 * @since 2.1.0
do_action( 'login_form' )
  • Yeah, I checked the source of wp_login_form() prior to asking my question and saw that there is no do_action() call but I thought I might be missing something. So, definitely not working as expected. Thanks for confirming.
    – Bran
    Nov 21, 2016 at 21:13

In order for it to work the action function should be using the "echo" statement:

add_action('login_form', function () {
    echo "<p>You can type a little note to those logging in here.</p>";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.