Title: wp_auth_check_html
Published: April 25, 2014
Last modified: August 20, 2026

---

# wp_auth_check_html()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#wp--skip-link--target)

Outputs the HTML that shows the wp-login dialog when the user is no longer logged
in.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#source)󠁿

    ```php
    function wp_auth_check_html() {
    	$login_url      = wp_login_url();
    	$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
    	$same_domain    = str_starts_with( $login_url, $current_domain );

    	/**
    	 * Filters whether the authentication check originated at the same domain.
    	 *
    	 * @since 3.6.0
    	 *
    	 * @param bool $same_domain Whether the authentication check originated at the same domain.
    	 */
    	$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
    	$wrap_class  = $same_domain ? 'hidden' : 'hidden fallback';

    	?>
    	<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
    	<div id="wp-auth-check-bg"></div>
    	<div id="wp-auth-check">
    	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text">
    		<?php
    		/* translators: Hidden accessibility text. */
    		_e( 'Close dialog' );
    		?>
    	</span></button>
    	<?php

    	if ( $same_domain ) {
    		$login_src = add_query_arg(
    			array(
    				'interim-login' => '1',
    				'wp_lang'       => get_user_locale(),
    			),
    			$login_url
    		);
    		?>
    		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( $login_src ); ?>"></div>
    		<?php
    	}

    	?>
    	<div class="wp-auth-fallback">
    		<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e( 'Session expired' ); ?></b></p>
    		<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e( 'Please log in again.' ); ?></a>
    		<?php _e( 'The login page will open in a new tab. After logging in you can close it and return to this page.' ); ?></p>
    	</div>
    	</div>
    	</div>
    	<?php
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/functions.php#L7593)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/functions.php#L7593-L7642)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#hooks)󠁿

 [apply_filters( ‘wp_auth_check_same_domain’, bool $same_domain )](https://developer.wordpress.org/reference/hooks/wp_auth_check_same_domain/)

Filters whether the authentication check originated at the same domain.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#related)󠁿

| Uses | Description | 
| [get_user_locale()](https://developer.wordpress.org/reference/functions/get_user_locale/)`wp-includes/l10n.php` |

Retrieves the locale of a user.

  | 
| [wp_login_url()](https://developer.wordpress.org/reference/functions/wp_login_url/)`wp-includes/general-template.php` |

Retrieves the login URL.

  | 
| [is_ssl()](https://developer.wordpress.org/reference/functions/is_ssl/)`wp-includes/load.php` |

Determines if SSL is used.

  | 
| [_e()](https://developer.wordpress.org/reference/functions/_e/)`wp-includes/l10n.php` |

Displays translated text.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

[Show 4 more](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_auth_check_html/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_auth_check_html%2F)
before being able to contribute a note or feedback.