v class=”wbt-detail-hd”>

login_header

函数


login_header ( $title = 'Log In', $message = '', $wp_error = null )
å‚æ•°
  • (string)
    $title
    Optional. WordPress login Page title to display in the `` element. Default ‘Log In’. <dl class="item-tag"><dt> <span>Required:</span> å¦ </dt> <dt> <span>Default:</span> ‘Log In’ </dt> </dl><p></p>
  • (string)
    $message
    Optional. Message to display in header. Default empty.
    Required: å¦
    Default: (empty)
  • (WP_Error)
    $wp_error
    Optional. The error to pass. Default is a WP_Error instance.
    Required: å¦
    Default: null
定义ä½ç½®
  • wp-login.php
    , line 41
引入
2.1.0
弃用

Output the login page header.

function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
	global $error, $interim_login, $action;

	// Don't index any of these forms.
	add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
	add_action( 'login_head', 'wp_strict_cross_origin_referrer' );

	add_action( 'login_head', 'wp_login_viewport_meta' );

	if ( ! is_wp_error( $wp_error ) ) {
		$wp_error = new WP_Error();
	}

	// Shake it!
	$shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'retrieve_password_email_failure' );
	/**
	 * Filters the error codes array for shaking the login form.
	 *
	 * @since 3.0.0
	 *
	 * @param string[] $shake_error_codes Error codes that shake the login form.
	 */
	$shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );

	if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) {
		add_action( 'login_footer', 'wp_shake_js', 12 );
	}

	$login_title = get_bloginfo( 'name', 'display' );

	/* translators: Login screen title. 1: Login screen name, 2: Network or site name. */
	$login_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $login_title );

	if ( wp_is_recovery_mode() ) {
		/* translators: %s: Login screen title. */
		$login_title = sprintf( __( 'Recovery Mode — %s' ), $login_title );
	}

	/**
	 * Filters the title tag content for login page.
	 *
	 * @since 4.9.0
	 *
	 * @param string $login_title The page title, with extra context added.
	 * @param string $title       The original page title.
	 */
	$login_title = apply_filters( 'login_title', $login_title, $title );

	?>
	><?php echo $login_title; ?>get_error_code() ) {
		?>
		

add( 'error', $error ); unset( $error ); } if ( $wp_error->has_errors() ) { $errors = ''; $messages = ''; foreach ( $wp_error->get_error_codes() as $code ) { $severity = $wp_error->get_error_data( $code ); foreach ( $wp_error->get_error_messages( $code ) as $error_message ) { if ( 'message' === $severity ) { $messages .= ' ' . $error_message . "
n"; } else { $errors .= ' ' . $error_message . "
n"; } } } if ( ! empty( $errors ) ) { /** * Filters the error messages displayed above the login form. * * @since 2.1.0 * * @param string $errors Login error message. */ echo '
' . apply_filters( 'login_errors', $errors ) . "
n"; } if ( ! empty( $messages ) ) { /** * Filters instructional messages displayed above the login form. * * @since 2.5.0 * * @param string $messages Login messages. */ echo '

' . apply_filters( 'login_messages', $messages ) . "

n"; } } } // End of login_header().