Skip to content
  • Log In
  • Register
WordPress.org
  • News
  • Download & Extend
    • Get WordPress
    • Themes
    • Patterns
    • Plugins
    • Openverse
    • Mobile
    • Hosting
  • Learn
    • Learn WordPress
    • Documentation
    • Forums
    • WordPress.tv
    • Developers
  • Community
    • Make WordPress
    • WordCamp
    • Meetups
    • Photo Directory
    • Job Board
    • Five for the Future
  • About
    • About WordPress
    • Showcase
    • Gutenberg
    • Enterprise
    • WordPress Swag Store
  • Get WordPress
Get WordPress

Developer Resources

Browse: Home / Reference / Hooks / login_message

apply_filters( 'login_message', string $message )

Filters the message to display above the login form.

Contents

  • Parameters
  • More Information
  • Source
  • Related
    • Used By
  • Changelog
  • User Contributed Notes

Parameters

$message string
Login message text.

Top ↑

More Information

TheĀ “login_message” filter is used to filter the message displayed on the WordPress login page above the login form. This filter can return HTML markup.


Top ↑

Source

File: wp-login.php. View all references

$message = apply_filters( 'login_message', $message );

View on Trac View on GitHub


Top ↑

Related

Top ↑

Used By

Used By
Used By Description
login_header() wp-login.php

Output the login page header.


Top ↑

Changelog

Changelog
Version Description
2.1.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
    Contributed by Razon Komar Pal — 3 years ago

    Add additional message for wp-login.php

    add_filter( 'login_message', 'wpdocs_sr_custom_login_message' );
    function wpdocs_sr_custom_login_message( $message ) {
        $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
        $errors = new WP_Error();
    
        if ( isset( $_GET['key'] ) ) {
            $action = 'resetpass';
        }
    
        if ( isset( $_GET['checkemail'] ) ) {
            $action = 'checkemail';
        }
    
        switch ( $action ):
            case 'register':
                $message .= '<p class="message">' . __( 'Show message before register form.', 'text_domain' ) . '</p>';
                break;
            case 'checkemail':
                $message .= '<p class="message">' . __( 'Show message before after registration complete message.', 'text_domain' ) . '</p>';
                break;
            case 'lostpassword':
                $message .= '<p class="message">' . __( 'Show message before lost password form.', 'text_domain' ) . '</p>';
                break;
            default:
                // this message will show in login screen, before the login form.
                $message .= '<p class="message">' . __( 'Show message before login form.', 'text_domain' ) . '</p>';
                break;
        endswitch;
    
        return $message;
    }
    Log in to add feedback
  2. Skip to note 2 content
    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
    Contributed by Collins Mbaka — 2 years ago

    An example

    function wpdocs_the_login_message( $message ) {
        if ( empty( $message ) ) {
            return '<p>Welcome to this site. Please log in to continue.</p>';
        } else {
            return $message;
        }
    }
    add_filter( 'login_message', 'wpdocs_the_login_message' );
    Log in to add feedback
  3. Skip to note 3 content
    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
    Contributed by Collins Mbaka — 2 years ago

    A plugin can register as a content filter with the code:

    add_filter( 'login_message', 'wpdocs_plugin_function_name' );
    Log in to add feedback
  4. Skip to note 4 content
    You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note
    Contributed by Akira Tachibana — 2 years ago

    (From Codex)
    Example:

    function the_login_message( $message ) {
        if ( empty($message) ){
            return "<p>Welcome to this site. Please log in to continue</p>";
        } else {
            return $message;
        }
    }
    add_filter( 'login_message', 'the_login_message' );
    Log in to add feedback

You must log in before being able to contribute a note or feedback.

  • About
  • News
  • Hosting
  • Donate
  • Swag
  • Documentation
  • Developers
  • Get Involved
  • Learn
  • Showcase
  • Plugins
  • Themes
  • Patterns
  • WordCamp
  • WordPress.TV
  • BuddyPress
  • bbPress
  • WordPress.com
  • Matt
  • Privacy
  • Public Code
WordPress.org
WordPress.org
  • Visit our Facebook page
  • Visit our Twitter account
  • Visit our Instagram account
  • Visit our LinkedIn account
Code is Poetry

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.