wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
is_user_logged_in › WordPress Function
Seit2.0.0
Veraltetn/v
› is_user_logged_in ( Keine Parameter )
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Determines whether the current visitor is a logged in user.
For more information on this and similar theme functions, check out the {@link Conditional Tags} article in the Theme Developer Handbook.Ähnliche Funktionen: is_user_admin, is_super_admin, is_serialized_string, wp_ajax_logged_in, is_login
Quellcode
function is_user_logged_in() {
$user = wp_get_current_user();
return $user->exists();
}
endif;
if ( ! function_exists( 'auth_redirect' ) ) :
/**
* Checks if a user is logged in, if not it redirects them to the login page.
*
* When this code is called from a page, it checks to see if the user viewing the page is logged in.
* If the user is not logged in, they are redirected to the login page. The user is redirected
* in such a way that, upon logging in, they will be sent directly to the page they were originally
* trying to access.
*
* @since 1.5.0
*/