简体   繁体   中英

WordPress check if user logged in works only after some time

这是我的服务如何工作的图片

I'm working on page: http://mytengo.com . It's service with ads. When user click +Add new ad, he will be automatically redirected to login page (if he's not logged in). When he log in, He should see New Ad page, But now it's redirecting me once more to Login page (is_user_logged_in = false), and in the login page it redirecting me to Profile page (is_user_logged_in = true).

But when I log in and open this page after 5 minutes it works fine, I can Add new ad. How to solve this problem? I try to change the code a lot of times, so I think the problem is in something else.

global $redux_demo;
$hide_map = $redux_demo['hide-map'];

if ( !is_user_logged_in() ) {
   $login = $redux_demo['login'];
   wp_redirect( $login ); 
   exit;

} else {
}

清除缓存,可能还有一些东西。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM