is_user_logged_in
函数
is_user_logged_in ( No parameters )
- 返回值
-
- (bool) True if user is logged in, false if not logged in.
- 定义位置
-
-
wp-includes/pluggable.php
, line 1147
-
wp-includes/pluggable.php
- 引入
- 2.0.0
- 弃用
- –
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.
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 */
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。