Expected behavior
When a nonce is verified with wp_verify_nonce, it should return true when the nonce is correct.
Current behavior
Apparently in CP2.0 it doesn’t work, it always returns false.
if (!wp_verify_nonce($nonce, 'ajax_pagination2')) {
wp_die('Nonce invalid', 403);
}
I even tried manually, it doesn’t work either.
if (!wp_verify_nonce('277035857a', 'ajax_pagination2')) {
wp_die('Nonce invalid', 403);
}
Besides, wp_send_json_success doesn’t work either.
wp_send_json_success($rendered_content);
It doesn’t send anything to the browser.
Possible solution
Steps to reproduce
$nonce = wp_create_nonce( 'nonce_test' );
if (!wp_verify_nonce($nonce, 'nonce_test'));
echo '<h1>Nonce fail</h1>';
Context
Simply implementing a pagination through ajax, or infinite scroll using standard solution like
add_action('wp_ajax_nopriv_ajax_pagination2', 'ajax_pagination2');
add_action('wp_ajax_ajax_pagination2', 'ajax_pagination2');