Wordpress admin-ajax results in Error 302 redirect

前端 未结 4 1708
孤独总比滥情好
孤独总比滥情好 2021-02-19 20:11

I have customized a plugin to make some ajax calls to admin-ajax.php and it works great. I copied the code over to another site and it no longer works for users who are not logg

4条回答
  •  佛祖请我去吃肉
    2021-02-19 20:44

    change condition to

    !user_can($current_user->ID, 'administrator') && ( !user_can($current_user->ID, 'contributor') ) && !is_ajax()
    

    add !is_ajax()

提交回复
热议问题