ajax - check_ajax_reffer not working when logged

When I'm logged, the code works perfect, but if no logged, check_ajax_reffer fails.First, pass ajax_url and nonce&#

When I'm logged, the code works perfect, but if no logged, check_ajax_reffer fails.

First, pass ajax_url and nonce's':

wp_localize_script( $this->plugin_name, 'ajax_object',
            array( 'ajax_url' => admin_url( 'admin-ajax.php' ), 'security_price'  => wp_create_nonce('ga_price'), 'security_arquivo'  => wp_create_nonce('ga_arquivo') ) );

And then simply validate:

if ($data == null && defined( 'DOING_AJAX' )) {
    check_ajax_referer('ga_price', 'security_price');
    ...

Why does it happen?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745280217a4620243.html

相关推荐

  • ajax - check_ajax_reffer not working when logged

    When I'm logged, the code works perfect, but if no logged, check_ajax_reffer fails.First, pass ajax_url and nonce&#

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信