login_message

最后更新于:2021-11-27 04:40:49

apply_filters( ‘login_message’, string $message )

Filters the message to display above the login form.

参数

$message

(string)
Login message text.

源文件

文件: gc-login.php

View on Trac

add_filter( 'login_message', 'gcdocs_sr_custom_login_message' );
function gcdocs_sr_custom_login_message( $message ) {
    $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : '';
    $errors = new GC_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;
}