Home » Hooks » login_message

The "login_message" hook is a WordPress filter hook that allows developers to add customized messages or content to the login page. This hook is useful for developers who want to display important information, such as a site notice or a welcome message, to authenticated users when they log in.

The "login_message" hook takes a single parameter, which is the default message displayed on the login page. Developers can modify this default message by adding their own custom content to the hook.

Here’s an example usage code:

function custom_login_message( $message ) {
    $message = '<p>Welcome to our website. Please enter your credentials to log in.</p>';
    return $message;
add_filter( 'login_message', 'custom_login_message' );

In this example, we’re using the "add_filter" function to add a custom message to the login page. The "custom_login_message" function modifies the default message by adding a welcome message to the login page. The modified message is then returned and displayed on the login page.

Learn More on WordPress.org

Register an account to save your snippets or go Pro to get more features.