login_header

Output the login page header.

Description

login_header( (string) $title = 'Log In', (string) $message = '', (string) $wp_error = '' ); 

Parameters (3)

0. $title — Optional. (string) => 'Log In'
WordPress login Page title to display in the element. Default Log In..</dd><dt> <span class="index">1.</span> <span class="param"> $message </span> — Optional. <span class="type">(string)</span> => <code>''</code></dt><dd> Message to display in header. Default empty.</dd><dt> <span class="index">2.</span> <span class="param"> $wp_error </span> — Optional. <span class="type">(string)</span> => <code>''</code></dt><dd> The <a href="http://hookr.io/classes/error" title="error" class="code class"><code>error</code></a> to pass. Default empty.</dd></dl> </section><hr /> <section id="usage"><h2>Usage</h2><pre><ol><li><div>if ( !function_exists( '<span class="func">login_header</span>' ) ) { </div></li><li><div> require_once '/wp-login.php'; </div></li><li><div>} </div></li><li><div>  </div></li><li><div><span class="comment">// Optional. WordPress login Page title to display in the `<title>` element.</span> </div></li><li><div><span class="comment">// Default 'Log In'.</span> </div></li><li><div><span class="param">$title</span> = 'Log In'; </div></li><li><div>  </div></li><li><div><span class="comment">// Optional. Message to display in header. Default empty.</span> </div></li><li><div><span class="param">$message</span> = ''; </div></li><li><div>  </div></li><li><div><span class="comment">// Optional. The error to pass. Default empty.</span> </div></li><li><div><span class="param">$wp_error</span> = ''; </div></li><li><div>  </div></li><li><div><span class="comment">// NOTICE! Understand what this does before running.</span> </div></li><li><div><span class="param">$result</span> = <span class="func">login_header</span>(<span class="param">$title</span>, <span class="param">$message</span>, <span class="param">$wp_error</span>); </div></li><li><div>  </div></li></ol></pre></section><hr /> <section id="defined" class="source"><h2>Defined <span class="count">(1)</span></h2><p>The function is defined in the following location(s).</p><dl><dt><strong><a href="http://hookr.io/4.7.4/files/wp-login/" class="file">/wp-login.php <span> </span></a></strong></dt><dd><pre><ol data-line="26" class="block" start="33"><li><div>function login_header( $title = 'Log In', $message = '', $wp_error = '' ) { </div></li><li><div> global $error, $interim_login, $action; </div></li><li><div> </div></li><li><div> // Don't index any of these forms </div></li><li><div> <a href="http://hookr.io/4.7.4/functions/add_action/" data-id="1421372" title="add_action" class="function">add_action</a>( <a href="http://hookr.io/4.7.4/actions/login_head/" data-id="1423280" title="login_head" class="action">'login_head'</a>, '<a href="http://hookr.io/4.7.4/functions/wp_no_robots/" data-id="1419995" title="wp_no_robots" class="function">wp_no_robots</a>' ); </div></li><li><div> </div></li><li><div> <a href="http://hookr.io/4.7.4/functions/add_action/" data-id="1421372" title="add_action" class="function">add_action</a>( <a href="http://hookr.io/4.7.4/actions/login_head/" data-id="1423280" title="login_head" class="action">'login_head'</a>, '<a href="http://hookr.io/4.7.4/functions/wp_login_viewport_meta/" data-id="1423207" title="wp_login_viewport_meta" class="function">wp_login_viewport_meta</a>' ); </div></li><li><div> </div></li><li><div> if ( empty($wp_error) ) </div></li><li><div> $wp_error = new <a href="http://hookr.io/4.7.4/classes/wp_error/" data-id="1418158" title="WP_Error" class="class">WP_Error</a>(); </div></li><li><div> </div></li><li><div> // Shake it! </div></li><li><div> $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' ); </div></li><li><div> /** </div></li><li><div> * Filters theerrorcodes array for shaking the login form. </div></li><li><div> * </div></li><li><div> * @since 3.0.0 </div></li><li><div> * </div></li><li><div> * @param array $shake_error_codes <a href="http://hookr.io/4.7.4/classes/error/" data-id="1421921" title="Error" class="class">Error</a> codes that shake the login form. </div></li><li><div> */ </div></li><li><div> $shake_error_codes = <a href="http://hookr.io/4.7.4/functions/apply_filters/" data-id="1421358" title="apply_filters" class="function">apply_filters</a>( <a href="http://hookr.io/4.7.4/filters/shake_error_codes/" data-id="1423277" title="shake_error_codes" class="filter">'shake_error_codes'</a>, $shake_error_codes ); </div></li><li><div> </div></li><li><div> if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) </div></li><li><div> <a href="http://hookr.io/4.7.4/functions/add_action/" data-id="1421372" title="add_action" class="function">add_action</a>( <a href="http://hookr.io/4.7.4/actions/login_head/" data-id="1423280" title="login_head" class="action">'login_head'</a>, '<a href="http://hookr.io/4.7.4/functions/wp_shake_js/" data-id="1423205" title="wp_shake_js" class="function">wp_shake_js</a>', 12 ); </div></li><li><div> </div></li><li><div> $separator = <a href="http://hookr.io/4.7.4/functions/is_rtl/" data-id="1420703" title="is_rtl" class="function">is_rtl</a>() ? ' › ' : ' ‹ '; </div></li><li><div> </div></li><li><div> ?><!DOCTYPE html> </div></li><li><div> <!--[if IE 8]> </div></li><li><div> <html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php <a href="http://hookr.io/4.7.4/functions/language_attributes/" data-id="1420005" title="language_attributes" class="function">language_attributes</a>(); ?>> </div></li><li><div> <![endif]--> </div></li><li><div> <!--[if !(IE 8) ]><!--> </div></li><li><div> <html xmlns="http://www.w3.org/1999/xhtml" <?php <a href="http://hookr.io/4.7.4/functions/language_attributes/" data-id="1420005" title="language_attributes" class="function">language_attributes</a>(); ?>> </div></li><li><div> <!--<![endif]--> </div></li><li><div> <head> </div></li><li><div> <meta http-equiv="Content-Type" content="<?php <a href="http://hookr.io/4.7.4/functions/bloginfo/" data-id="1419919" title="bloginfo" class="function">bloginfo</a>('html_type'); ?>; charset=<?php <a href="http://hookr.io/4.7.4/functions/bloginfo/" data-id="1419919" title="bloginfo" class="function">bloginfo</a>('charset'); ?>" /> </div></li><li><div> <title><?php echo <a href="http://hookr.io/4.7.4/functions/get_bloginfo/" data-id="1419922" title="get_bloginfo" class="function">get_bloginfo</a>( 'name', 'display' ) . $separator . $title; ?></title> </div></li><li><div> <?php </div></li><li><div> </div></li><li><div> <a href="http://hookr.io/4.7.4/functions/wp_enqueue_style/" data-id="1419298" title="wp_enqueue_style" class="function">wp_enqueue_style</a>( 'login' ); </div></li><li><div> </div></li><li><div> /** </div></li><li><div> * Remove all stored post data on logging out. </div></li><li><div> * This could be added by <a href="http://hookr.io/4.7.4/functions/add_action/" data-id="1421372" title="add_action" class="function">add_action</a>(<a href="http://hookr.io/4.7.4/actions/login_head/" data-id="1423280" title="login_head" class="action">'login_head'</a>...) like <a href="http://hookr.io/4.7.4/functions/wp_shake_js/" data-id="1423205" title="wp_shake_js" class="function">wp_shake_js</a>(),  </div></li><li><div> * but maybe better if it's not removable by plugins </div></li><li><div> */ </div></li><li><div> if ( 'loggedout' == $wp_error->get_error_code() ) { </div></li><li><div> ?> </div></li><li><div> <script>if("sessionStorage" in window) {try{for(var key in sessionStorage) {if(key.indexOf("wp-autosave-")!=-1) {sessionStorage.removeItem(key)}}}catch(e) {}};</script> </div></li><li><div> <?php </div></li><li><div> } </div></li><li><div> </div></li><li><div> /** </div></li><li><div> * Enqueue scripts and styles for the login page. </div></li><li><div> * </div></li><li><div> * @since 3.1.0 </div></li><li><div> */ </div></li><li><div> <a href="http://hookr.io/4.7.4/functions/do_action/" data-id="1421373" title="do_action" class="function">do_action</a>( <a href="http://hookr.io/4.7.4/actions/login_enqueue_scripts/" data-id="1423279" title="login_enqueue_scripts" class="action">'login_enqueue_scripts'</a> ); </div></li><li><div> </div></li><li><div> /** </div></li><li><div> * Fires in the login page header after scripts are enqueued. </div></li><li><div> * </div></li><li><div> * @since 2.1.0 </div></li><li><div> */ </div></li><li><div> <a href="http://hookr.io/4.7.4/functions/do_action/" data-id="1421373" title="do_action" class="function">do_action</a>( <a href="http://hookr.io/4.7.4/actions/login_head/" data-id="1423280" title="login_head" class="action">'login_head'</a> ); </div></li><li><div> </div></li><li><div> if ( <a href="http://hookr.io/4.7.4/functions/is_multisite/" data-id="1420717" title="is_multisite" class="function">is_multisite</a>() ) { </div></li><li><div> $login_header_url = <a href="http://hookr.io/4.7.4/functions/network_home_url/" data-id="1421461" title="network_home_url" class="function">network_home_url</a>(); </div></li><li><div> $login_header_title = <a href="http://hookr.io/4.7.4/functions/get_network/" data-id="1421007" title="get_network" class="function">get_network</a>()->site_name; </div></li><li><div> } else { </div></li><li><div> $login_header_url = <a href="http://hookr.io/4.7.4/functions/__/" data-id="1420645" title="__" class="function">__</a>( 'https://wordpress.org/' ); </div></li><li><div> $login_header_title = <a href="http://hookr.io/4.7.4/functions/__/" data-id="1420645" title="__" class="function">__</a>( 'Powered by WordPress' ); </div></li><li><div> } </div></li><li><div> </div></li><li><div> /** </div></li><li><div> * Filters link URL of the header logo above login form. </div></li><li><div> * </div></li><li><div> * @since 2.1.0 </div></li><li><div> * </div></li><li><div> * @param string $login_header_url Login header logo URL. </div></li><li><div> */ </div></li><li><div> $login_header_url = <a href="http://hookr.io/4.7.4/functions/apply_filters/" data-id="1421358" title="apply_filters" class="function">apply_filters</a>( <a href="http://hookr.io/4.7.4/filters/login_headerurl/" data-id="1423281" title="login_headerurl" class="filter">'login_headerurl'</a>, $login_header_url ); </div></li><li><div> </div></li><li><div> /** </div></li><li><div> * Filters the title attribute of the header logo above login form. </div></li><li><div> * </div></li><li><div> * @since 2.1.0 </div></li><li><div> * </div></li><li><div> * @param string $login_header_title Login header logo title attribute. </div></li><li><div> */ </div></li><li><div> $login_header_title = <a href="http://hookr.io/4.7.4/functions/apply_filters/" data-id="1421358" title="apply_filters" class="function">apply_filters</a>( <a href="http://hookr.io/4.7.4/filters/login_headertitle/" data-id="1423283" title="login_headertitle" class="filter">'login_headertitle'</a>, $login_header_title ); </div></li><li><div> </div></li><li><div> $classes = array( 'login-action-' . $action, 'wp-core-ui' ); </div></li><li><div> if ( <a href="http://hookr.io/4.7.4/functions/is_rtl/" data-id="1420703" title="is_rtl" class="function">is_rtl</a>() ) </div></li><li><div> $classes[] = 'rtl'; </div></li><li><div> if ( $interim_login ) { </div></li><li><div> $classes[] = 'interim-login'; </div></li><li><div> ?> </div></li><li><div> <style type="text/css">html{background-color: transparent;}</style> </div></li><li><div> <?php </div></li><li><div> </div></li><li><div> if ( 'success' === $interim_login ) </div></li><li><div> $classes[] = 'interim-login-success'; </div></li><li><div> } </div></li><li><div> $classes[] =' locale-' . <a href="http://hookr.io/4.7.4/functions/sanitize_html_class/" data-id="1420087" title="sanitize_html_class" class="function">sanitize_html_class</a>( strtolower( str_replace( '<a href="http://hookr.io/4.7.4/functions/_/" data-id="1418633" title="_" class="function">_</a>', '-', <a href="http://hookr.io/4.7.4/functions/get_locale/" data-id="1420639" title="get_locale" class="function">get_locale</a>() ) ) ); </div></li><li><div> </div></li><li><div> /** </div></li><li><div> * Filters the login page body classes. </div></li><li><div> * </div></li><li><div> * @since 3.5.0 </div></li><li><div> * </div></li><li><div> * @param array $classes An array of body classes. </div></li><li><div> * @param string $action The action that brought the visitor to the login page. </div></li><li><div> */ </div></li><li><div> $classes = <a href="http://hookr.io/4.7.4/functions/apply_filters/" data-id="1421358" title="apply_filters" class="function">apply_filters</a>( <a href="http://hookr.io/4.7.4/filters/login_body_class/" data-id="1423285" title="login_body_class" class="filter">'login_body_class'</a>, $classes, $action ); </div></li><li><div> </div></li><li><div> ?> </div></li><li><div> </head> </div></li><li><div> <body class="login <?php echo <a href="http://hookr.io/4.7.4/functions/esc_attr/" data-id="1420646" title="esc_attr" class="function">esc_attr</a>( implode( ' ', $classes ) ); ?>"> </div></li><li><div> <?php </div></li><li><div> /** </div></li><li><div> * Fires in the login page header after the body tag is opened. </div></li><li><div> * </div></li><li><div> * @since 4.6.0 </div></li><li><div> */ </div></li><li><div> <a href="http://hookr.io/4.7.4/functions/do_action/" data-id="1421373" title="do_action" class="function">do_action</a>( <a href="http://hookr.io/4.7.4/actions/login_header/" data-id="1423287" title="login_header" class="action">'login_header'</a> ); </div></li><li><div> ?> </div></li><li><div> <div id="login"> </div></li><li><div> <h1><a href="<?php echo <a href="http://hookr.io/4.7.4/functions/esc_url/" data-id="1420129" title="esc_url" class="function">esc_url</a>( $login_header_url ); ?>" title="<?php echo <a href="http://hookr.io/4.7.4/functions/esc_attr/" data-id="1420646" title="esc_attr" class="function">esc_attr</a>( $login_header_title ); ?>" tabindex="-1"><?php <a href="http://hookr.io/4.7.4/functions/bloginfo/" data-id="1419919" title="bloginfo" class="function">bloginfo</a>( 'name' ); ?></a></h1> </div></li><li><div> <?php </div></li><li><div> </div></li><li><div> unset( $login_header_url, $login_header_title ); </div></li><li><div> </div></li><li><div> /** </div></li><li><div> * Filters the message to display above the login form. </div></li><li><div> * </div></li><li><div> * @since 2.1.0 </div></li><li><div> * </div></li><li><div> * @param string $message Login message text. </div></li><li><div> */ </div></li><li><div> $message = <a href="http://hookr.io/4.7.4/functions/apply_filters/" data-id="1421358" title="apply_filters" class="function">apply_filters</a>( <a href="http://hookr.io/4.7.4/filters/login_message/" data-id="1423289" title="login_message" class="filter">'login_message'</a>, $message ); </div></li><li><div> if ( !empty( $message ) ) </div></li><li><div> echo $message . "\n"; </div></li><li><div> </div></li><li><div> // In case a plugin uses $error rather than the $wp_errors object </div></li><li><div> if ( !empty( $error ) ) { </div></li><li><div> $wp_error->add(error, $error); </div></li><li><div> unset($error); </div></li><li><div> } </div></li><li><div> </div></li><li><div> if ( $wp_error->get_error_code() ) { </div></li><li><div> $errors = ''; </div></li><li><div> $messages = ''; </div></li><li><div> foreach ( $wp_error->get_error_codes() as $code ) { </div></li><li><div> $severity = $wp_error->get_error_data( $code ); </div></li><li><div> foreach ( $wp_error->get_error_messages( $code ) as $error_message ) { </div></li><li><div> if ( 'message' == $severity ) </div></li><li><div> $messages .= ' ' . $error_message . "<br />\n"; </div></li><li><div> else </div></li><li><div> $errors .= ' ' . $error_message . "<br />\n"; </div></li><li><div> } </div></li><li><div> } </div></li><li><div> if ( ! empty( $errors ) ) { </div></li><li><div> /** </div></li><li><div> * Filters theerrormessages displayed above the login form. </div></li><li><div> * </div></li><li><div> * @since 2.1.0 </div></li><li><div> * </div></li><li><div> * @param string $errors Loginerrormessage. </div></li><li><div> */ </div></li><li><div> echo '<div id="login_error">' . <a href="http://hookr.io/4.7.4/functions/apply_filters/" data-id="1421358" title="apply_filters" class="function">apply_filters</a>( <a href="http://hookr.io/4.7.4/filters/login_errors/" data-id="1423291" title="login_errors" class="filter">'login_errors'</a>, $errors ) . "</div>\n"; </div></li><li><div> } </div></li><li><div> if ( ! empty( $messages ) ) { </div></li><li><div> /** </div></li><li><div> * Filters instructional messages displayed above the login form. </div></li><li><div> * </div></li><li><div> * @since 2.5.0 </div></li><li><div> * </div></li><li><div> * @param string $messages Login messages. </div></li><li><div> */ </div></li><li><div> echo '<p class="message">' . <a href="http://hookr.io/4.7.4/functions/apply_filters/" data-id="1421358" title="apply_filters" class="function">apply_filters</a>( <a href="http://hookr.io/4.7.4/filters/login_messages/" data-id="1423294" title="login_messages" class="filter">'login_messages'</a>, $messages ) . "</p>\n"; </div></li><li><div> } </div></li><li><div> } </div></li><li><div>} // End of login_header() </div></li></ol></pre></dd></dl> </section> </article></div><div id="sidebar"><ul class="widgets"><li> <a href="http://hookr.io/plugin/"><img src="http://hookr.io/wp-content/themes/hookr/assets/images/plugin-download.jpg" /></a></li><li id="versions"><dl><dt>Version(s)</dt><dd><dl><dt>Since</dt><dd> 4.7</dd><dt>Others</dt><dd><ul><li><a href="http://hookr.io/4.7.4/functions/login_header/" class="active">4.7.4</a></li><li><a href="http://hookr.io/4.7.3/functions/login_header/" class="">4.7.3</a></li><li><a href="http://hookr.io/4.7.2/functions/login_header/" class="">4.7.2</a></li><li><a href="http://hookr.io/4.7.1/functions/login_header/" class="">4.7.1</a></li><li><a href="http://hookr.io/4.7/functions/login_header/" class="">4.7</a></li></ul></dd></dl></dd></dl></li><li id="tags"><dl><dt>Tags</dt><dd><ul><li><span></span>wordpress</li><li><span></span>function</li><li><span></span>login_header</li><li><span></span>wp-root</li></ul></dd></dl></li></ul></div></div></div><script>Hookr.View.init();Hookr.Single.init();</script><footer><div><ul id="nav-social" class="pivot" role="navigation"><li id="twitter"><a href="http://twitter.com/hookr_io" title="Follow me!"></a></li></ul><div> © 2018 hookr.io <strong>(beta)</strong> | <a href="http://hookr.io/privacy/" title="Privacy">Privacy</a> | Proudly Powered by WordPress</div></div> </footer><script type="text/javascript" src="http://hookr.io/wp-content/cache/minify/000000/M9EvL9BNzU1KTdHLzcwDAA.js"></script><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create','UA-49583310-1','hookr.io');ga('send','pageview');</script></body></html>