最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ajax - check_ajax_reffer not working when logged

programmeradmin1浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论