I am trying to modify the login page using built in filters. The add_actions are working as expected, but I cannot get the filters to work. This is the code that I have in my functions.php:

add_filter( 'login_form_top', 'filter_top_login' );
function filter_top_login( $content )
    return 'This is what I want it to say!';

but it doesn't seem to be doing anything when I load the wp-login.php page. What am I doing wrong?

5 Answers 5


While login_form_top is a valid hook called by the wp_login_form function, wp_login_form is not used in wp-login.php, nor is that function used anywhere else that I can find. I greped my entire 3.5.1 install and found one reference to the function-- the place where it is defined. It does not appear to actually be used anywhere by the Core.

You will need to search the wp-login.php file for hooks, such as login_form, and try to do what you need with those hooks, or write your own login page (though it sounds like that is what you are trying to avoid).


You can use the login_message filter, which will show your text just above the login form:

add_filter( 'login_message', 'my_login_message' );

function my_login_message() {
    return 'This is my message';

login_form_top filter isn't called in wp-login.php.

The only hook I can see in wp-login.php in login form area is login_form (it's called on line 689). But it's placed after both inputs (login/password) so it's more like login_form_middle.


As it is mentioned that login_form_top filter is not available in 'wp-login.php', alternatively, we can try placing it somewhere else and move it with javascript.

For example, you can insert code in footer (using login_footer) and move it to required place using javascript.

add_action( 'login_footer', 'login_form_customization', 12 );
function login_form_customization() {
    <p id='custom-login-html'>
        This is my html code.
        var htmlcode = document.getElementById("custom-login-html");
        var loginform = document.getElementById("loginform");

just remove the $content variable,

    add_filter( 'login_form_top', 'filter_top_login' );
function filter_top_login()
    return 'This is what I want it to say!';
  • That makes no difference. As a couple of other people have noted, the login_form_top filter is not called on wp-login.php. The login_message filter can be used instead. Commented Apr 30, 2014 at 22:58
  • yes you are right. I think I havent read carefully, I used that filter in wp_login_form, but question is looking for wp-login.php.
    – ewroman
    Commented May 1, 2014 at 7:55

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.