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
评论列表(0条)