Add a short message above the login form, such as a support link or a notice about scheduled maintenance.
add_filter( 'login_message', function ( string $message ): string {
// Only on the main login screen, not on lost password or register.
$action = isset( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : 'login';
if ( 'login' !== $action ) {
return $message;
}
$text = sprintf(
'Trouble logging in? <a href="%s">Contact support</a>.',
esc_url( home_url( '/support/' ) )
);
return $message . '<p class="message">' . wp_kses_post( $text ) . '</p>';
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
The login page is a good place for short, useful notes: where to get help, a reminder to use your work email, or a heads-up about planned downtime. This snippet adds one.
WordPress passes the message shown above the login form through login_message. The snippet adds a paragraph with the message class, so it uses the same blue notice style as WordPress’s own messages. It skips the lost password and register screens, which have their own messages.
/support/ link to your own help page.Log out and open the login page. Your message should appear above the form.